Custom Type Post Show on Homepage

In WordPress How to Custom Type Posts Show on Homepage of your WordPress Blog. Because default is not set your custom type post show on homepage so we are need to following function code add manually. and show your custom type post show on your home page.

 

WordPress home page can hold and show many different types of content. But all post is stored internally is same place in the wp_posts table. Custom type post Show on homepage in WordPress just put this code on your function.php file.

 

We need to prepare query to set the default post type and other your custom type. Add this filter code to your functions.php file:

 


function homepage_post_types($query) {
	if ( $query->is_home || is_feed && !isset($query->query_vars['post_type']))
        $query->set( 'post_type', array( 'post', 'your-custom-post-type-name-1', 'your-custom-post-type-name-2' ) );
    return $query;
}
add_filter('pre_get_posts', 'homepage_post_types');

 

Here I add is_feed to get post into main feed. Array you have to store first POST and other two is your own created custom post type name is write. So this function code is add in your function.php and your custom post type post is show on your home page.

Back to Top
About the Post Writer View all posts by
I'm write of this article and founder of Way2tutorial or Webtuts Web Development Programming blog. My passion is keen on contributing WEB Industry. Mostly I do work on PHP, WordPress, Drupal. I hope you enjoy with this articles. Thanks for reading.

2 Comments Discussion

  1. fajne filmy dla nastolatek on May 8, 2013 - Reply to this Comment

    Absolutely indited articles , appreciate it for entropy.

Leave a Reply

Your email address will not be published. Required fields are marked *