Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to set WordPress so that home page is static, and the blog page is a separate page. So, I created two page templates in my theme., lets call them home_template and blog_template.

Then, I created two WordPress pages (from Pages -> Add New). The first page is called Home, and is using home_template; and the second is called Blog and is using blog_template.

Then I went to the Settings -> Reading setting, and chose Front Page Displays A Static Page. And in the two drop downs that follow, I chose Home for Front Page, and selected Blog for Posts Page.

Then I went to Appearance -> Menu, and added the Blog page as a menu item.

Now, when I go to view my site, the home page is nice and dandy. However, when I click on the menu item for the blog page, I see that the blog page is using index.php to display its content, it is not using the page blog_template to display the content.

How can I make sure that the blog_template page is used? Please help and thanks.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

When you make a page the page for posts, it's no longer a "page" in the conventional sense. Refer to the Template Hierarchy for home page display- the quickest fix is to rename your blog template home.php, and WordPress will load that before index.php.

share|improve this answer
    
Thanks Milo, but could you explain more? What do you mean by "it is not longer a page in the conventional sense"? Why blog_template is not being used? Also you suggested the quickest fix is to renamte it to home.php; however I am not looking for the quickest fix, can you please elaborate more? Also, based in your suggestion for home.php, what's the point of using blog_template then? Should I name my template file home.php (in other words, home.php is the same file as blog_template). Thanks agian. –  Greeso Sep 9 '13 at 15:32
    
I mean it's no longer treated as a page post type, is_page() will return false on that page, it will now be is_home(). In this case the quickest fix is also the correct one. –  Milo Sep 9 '13 at 15:41
add comment

Do you have any archive.php file in your theme files? This should be the first file that is rendered when viewing the posts page. If it's not in there, then it defaults to using the index.php file. I would suggest renaming your blog_template file to be 'archive.php' if you don't have an archive page, or better yet, change it to 'archive-post.php' and see if it gets rendered correctly.

If in your blog_template file you are coding it to pull in the blog posts and have it formatted in the way you want, then I would say that in the Settings, do not set anything for posts page. That way, when you go to your "blog" page, the system will use the blog_template to render the view.

Going this route means that the template file will need to run the query for all posts, because when the page loads, the global object query will only have that page.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.