Misha Rudrastyh

Misha Rudrastyh

WordPress Developer

2 Ways of Creating Separate Blog Pages in WordPress

I know a lot of WordPress-based websites where a static page displays on the homepage and blog posts section is placed separately on a different page, e.g. yourwebsite.com/blog.

So, how to do that on your own website? I will show you 2 methods.

October 18, 2013October 8, 2016 4

I. Using index.php as a blog template

This method is very simple. It is default functionality in WordPress, with no additional code. It is used on many websites.

You should know one thing: some themes doesn’t have code for blogs in their index.php file, for such themes this method doesn’t work. In that case I recommend you to look at the second method, you can also find it in this post.

Step 1. Creating a Blog Page

First, go to the Pages > Add new, after that fill the title input field, I suppose it will be «Blog», and save the page.

creating blog page in WordPress admin

Step 2. Customizing Locations for Homepage and Blog Posts

Go to the Settings > Reading and set up a static page as the homepage and our blog page as a posts page.

Customizing locations for front page and posts page

Step 3. Add a Menu Item

This is an unnecessary step. If you have finished the second step, the blog will appears on the page URL, you just created. The blog page will also use index.php file as the template.

Anyway, if your current theme supports menus, you can add this page to website menus. If you want to do this, go to Appearance > Menus, add blog page to any menu and save it.

II. Using Your Own Page Template for Blog Posts

This method allows you to create blog sections using your own page template. This way is good when you need to display posts with your own parameters. You can also create multiple blog sections with different query arguments.

So, let’s begin.

Step 1. Creating Page Template

I suppose you already know how to do this, if you don’t, then open your current theme folder and create a php file there. You can name it as your want, e.g. blog-template.php. Into this file add the following code:

 * Template name: Blog section template

Step 2. Creating a Page

This step is similar to the first step in the first method, the only difference is that you should specify a page template in the «Page Attributes» section.

specify your blog section template

Step 3. Paging Navigation

Of course, we need a pagination for our blog section. You probably use some sort of plugins or your own function for these purposes. If something goes wrong, I recommend you to use WP-PageNavi plugin. I made some tests – this plugin works fine with the code from this tutorial.

Step 4. The Code for Page Template

This is just an example without some of important template functions such as get_header() or get_footer(). But this template contains everything you need to test your blog page.

 * Template name: Blog section template
$current_page = (get_query_var('paged')) ? get_query_var('paged') : 1; // get current page number
$args = array(
	'posts_per_page' => get_option('posts_per_page'), // the value from Settings > Reading by default
	'paged'          => $current_page // current page
query_posts( $args );
$wp_query->is_archive = true;
$wp_query->is_home = false;
while(have_posts()): the_post();
	<h2><?php the_title() /* post title */ ?></h2>
	<p><?php the_content() /* post content */ ?></p>
if( function_exists('wp_pagenavi') ) wp_pagenavi(); // WP-PageNavi function

Only new posts about WordPress

once a week

Comments 4

  • i am trying to use this tuterial but the page i have created in linking to home page …….
    who to redirect it to blog-theme.php

  • william steveDecember 18, 2014 at 05:12

    Compared to other web languages that require a bit of study, PHP does not require one to spend a lot of time researching a manual. Thanks to the syntax being logical and command functions describing exactly what they do, one can easily get right to the part of creating and optimizingthe application.If you have programming experience in both Perl and C, then learning PHP will be quite easy, as its syntax is based on these languages.Since PHP is an open source web language, it’s completely free of cost.Depending on how you code, (http://cedarsoftware.co.uk )PHP can turn out to be an efficient web language to use. In fact, PHP is known to be scalable when writing code as well as in creating applications and is very reliable when you need to serve several web pages.If you get stuck or are getting started when using PHP, one of the best places you can find information about the language is php.net apart from php pros from numerous websites and forums that are available over the internet

  • Nice work, A small issue ;)


    Is working only for index.php, (for the latest post)

    I have create multiple blog pages which each one display only post by a specific category and is not working correctly !

    any ideas ? :)

    • MishaAuthorJune 24, 2015 at 14:06

      There are plenty of another pagenavi solutions — check them :) I can write a post about page navigation without plugins if you want as well (on Monday).

Leave comment

Please, enter a comment
Please, enter a name
Incorrect email
© 2016 Misha Rudrastyh
Developed on with