Call us on 078 24 35 85 44 / e: info@thescube.com
logo


WordPress home post as page

Most of the wordpress blogs or themes display post in their home page, for one of my project I wanted to display pages in the home page template

This was the template code


get_option('theme_home_posts'),
'cat'=>'-'.get_cat_id(get_option('theme_featured')),
'paged'=>$paged,
);
query_posts($args);
while (have_posts()) : the_post(); ?>

To simplify the code, all the post with category theme_featured will display.
I have modified the code to

get_option('theme_home_posts'),
'paged'=>$paged,
'post_type' => 'page',
'post__in' => array(14,133,380,18,16,12)
);
query_posts($args);
while (have_posts()) : the_post(); ?>

I have removed the category option and included post type and post in option.
Post type defines if its a post or page and post in let wordpress know what post to include

Reffrence:

  • http://codex.wordpress.org/Custom_Queries
  • http://codex.wordpress.org/Class_Reference/WP_Query
  • http://wordpress.org/support/topic/page-query-and-post-query-on-the-same-page

 

VN:F [1.9.17_1161]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

WordPress home post as page, 5.0 out of 5 based on 1 rating

You might be interested in:

Leave a Reply

*

captcha *

Login with Facebook: