Our Blog

If you are looking for a way to separate your blog posts from the rest of your site, or if  you would like to add an easy way to access all recent posts…. keep reading.

WordPress has a built-in feature that allows you to assign a Page as your Static Homepage and another Page as your Post Page. But this feature does not work well for all themes because it assumes that index.php (your homepage) contains your list of recent posts.   Therefore, when you create a new Page called “Blog” and assign that as your Post Page….  what happens?   The “Blog” page will look exactly like your homepage.

This method works great for themes that only have posts on the homepage.   But if your theme contains other homepage elements such as Image Sliders, Highlights sections, etc.   you may not want those elements appearing on your “Blog” page.   This is when you will want to create a Page Template dedicated to displaying a list of your recent posts.   Here’s how:


1)  Open a new text file and add this to the very top of the file:

<?php
/*
Template Name: Blog Template
*/
?>


2)  Next, copy and paste the entire contents of your archive.php page into your new text file, directly below the code mentioned above.  (Most themes contain an archive.php file which defines how the list of recent posts should be displayed.   Different themes may call this file something else but in most cases, it is archive.php.)


3)  Within the newly pasted code, search for the start of the loop:  It begins with:

<?php if (have_posts()) : ?>

Directly ABOVE  <?php if (have_posts()) : ?> paste your query parameters.   For a list of all recent posts, you would paste: 

<?php query_posts(‘showposts=10′); ?>

You can change the “10” to the number of posts you want to show per page.  You can also change this query to show posts from specific categories like:

<?php query_posts(‘cat=12,5′); ?>


4)  Save this file as: template_blog.php and upload it to your theme folder.


5)  Create a new page where you wish to display your posts and give it a name such as “Blog”, “Posts”, “Latest News” …etc.   On the right side of the Page edit screen, select Blog Template from the Templates drop-down menu.   Click Update to save.


Now your latest posts will display on this Page!

Comments ( 3 )

  • Dendy says:

    Thanks, you have shared great info in here.
    But I have problem …. in my blog i’ve made template like you explain above but in order to showing my Guiding Page … Here it is:

    138 && get_option(‘thumbnail_crop’) == 1) {
    the_post_thumbnail(array(138,138));
    echo “”;
    }else{
    the_post_thumbnail(‘thumbnail’);
    echo “”;
    }
    endif;
    ?>
    in category

    <div id=”post-“>
    <a class="tip" href="” rel=”bookmark” title=””>

    <?php the_tags('Tags: ', ', ', '’); ?>

    Not Found
    Sorry, but you are looking for something that isn’t here.

    When i paste your advice code :

    Just above if (have_posts() code line, everything goes broken … what can i do to fix those problems?
    Thanks.

  • Longbourne says:

    Thank you – this was a simple approach and it worked simply perfectly! One caution – if you copy-and-paste the code for ‘show posts’, the font on this site uses curly quotes for the first one and it will break the page. So make sure you have straight quotes on this line:

    Thanks for the helpful post!

  • Martin says:

    your article was very helpful and I now have my about page as my static page (homepage) and created my blog page which holds all my posts but do have one problem with it.

    all post are shown in full and not in a summary which is what I want to have. I’ve tried in “settings> reading to change it but found out that the changing it there will only work for your rss feed.

    Can you please help me with this and email the resolution to me.

    many thanks
    Martin

Leave A Comment

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

Facebook

Twitter