Separate WP Blog PostJuly 16, 2013 by Admin
How to Create a Separate Page for Blog Posts in WordPress?
By default WordPress display your content in a blog format on the homepage. Users often modify for their needs by creating a custom home page in WordPress. What if you want to use WordPress to run your entire static site, and also use it as a blog? Well, now in this post I will tell you what changes you need in your code for a separate blog page. Supposing you created a new page from your index.php for blog and save it as blog.php, now you need to find the code below:
< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>
$temp = $wp_query;
$wp_query = new WP_Query();
while ($wp_query->have_posts()) : $wp_query->the_post();
< ?php else : ?>
< ?php endif; ?>
< ?php $wp_query = null; $wp_query = $temp;?>
‘posts_per_page=5′ is the number of posts that will be shown in the blog page.
Tags: separate blog post in wordpress