Move WordPress blog to inner page

OK, so i’ve already showed you how to put a static page on your wordpress home page. But what if you want a blog, but you want it showing on an inner page? Here’s the solution:

  1. Make a copy of your index.php file. Name it blog.php
  2. Open blog.php in a text editor
  3. add the following to the top of the file:
    <?php
    /*
    Template Name: Blog
    */

    $pagenum = $wp_query->query_vars;
    $pagenum = $pagenum['paged'];

    if (empty($pagenum)) {
    $pagenum = 1;
    }

    query_posts("posts_per_page=10&paged=$pagenum");
    ?>

  4. Create a new static page in the WP admin area. On the right side, one of the options is “Page Template”, select “Blog”.
  5. Navigate your browser to your new page. your blog should be there.

Edit: As of version 2.1, WordPress has this functionality built in, so there’s no need for hacks anymore. Just go to wp-admin -> Options – > Reading and you can set a static homepage and move your blog to an inner page.

  • December 18, 2006
  • | Category: WordPress
  • | Comments: 13

13 Responses to “Move WordPress blog to inner page”

  1. Very useful; as you said when using the home.php file to create the custom home page; which kills your blog page. Thank you for the code.

  2. T-Man says:

    OK this is a great solution. the Blog button appears right along side my other buttons. But I am having issues.

    1) When you click a page button, it is suppose to turn reddish and reflect the current page you are on.
    2) When you click BLOG page, you come to my blog page, but all of the tags are ignored. What do you think is happening?

    Thanks Rubin

  3. T-Man says:

    Actually, I am having more issues than I thought.

    My adsense plugin is also inactive now. Hmmm. Strange.

  4. T-Man says:

    HAHAHAH OK check that Rubin, my adsense plugin IS working. Now I am just being paranoid. :P

    BUT, I need to clarify one thing. In my next to last post that lists the two issues I am certain I am having, the 2) issue should read like this:
    2) When you click BLOG page button, you come to my blog page successfully, but all of the tags are ignored. What do you think is happening?

  5. T-Man says:

    `| more |` tags, I mean. :P I could not get the code to post.

  6. [...] Move WordPress blog to inner page- This ‘N That (tags: webdesign wordpress) [...]

  7. kjoker says:

    Merry Christmas And Happy New Year!!!!!! :D

  8. Zippy says:

    I tried this, but the “blog” page is only returning the most recent post… why?

    (I’m using MistyLook theme)
    http://wpthemes.info/misty-look/

    Would be grateful for any input, as yours seems like the easiest solution to create a static homepage!

  9. Zippy says:

    In re my above post:

    Ok, I tried the technique with the Kubrick (default) WP theme… and it displays all the posts, like it should.

    So there’s something up with the MistyLook theme… I’m wondering if it has to do with the fact that under “MistyLook Option” (under “Presentation”) you can rearrange the order of the pages?

    I’m a complete N00b… any thoughts about this?

  10. LobsterMan says:

    Zippy: Your theme probably adds in a query of its own later down, or edits the query.

  11. Raul says:

    Hi there,

    thanks for this solution, it’s great. I’ve been looking a while to implement this option. I still have some question though.

    Is it possible to show only the posts from a specific category on this new ‘blog’-page?

    And also, can this category be excluded from the main homepage??

    Thanks in advance!

    Raúl

  12. BustyBoots says:

    I don’t want to wait till the end of Summer :( , I want it now. Who with me?
    save your time and join me. ;)

  13. Strohhalme says:

    Hi, information great, great blog. You come in my link list. : D Can you somehow with you a newsletter.

Leave a Reply

bottom