Separating Static and Blog Pages with WordPress
One common question related to Wordpress relates to how one can have a “static” (in the sense that content doesn’t change) home page with just a simple link to the blog pages. That’s how this site is set up, though it’s subject to change. Just selecting a page as your home page under reading sections is fine for a simple blog site, but what if you want to have different sidebars or style changes between the two areas of your site? Here’s how I accomplished it for eGrace Creative.
Arrange your design, html, and your loop the way you want it to work for your pages and save the file as page.php. Then do the same for your blog and save it as index.php. I created a secondary loop (not the real term, but you get the idea) and added it to a duplication of page.php and named it home-page.php. At the top of that page, I inserted this within a php tag…
/*
Template Name: Home
*/
In WordPress, I created my front page and assigned the page template called “home” from the dropdown box. This tells WordPress to use the correct template file for the front page of my site.
Back to the drawing board, I duplicate my index.php, which has my blog loop, and name it blog.php. I do this at the top (within a php tag):
/*
Template Name: Blog
*/
In WordPress, I create another page with the slug “/blog/” and leave the content blank. In the page template dropdown box, I select “Blog” as the template for this page. On the front page of my site, I link to this as http://www.yourdomain.com/blog/. This page calls up my blog posts in date order. I’ve arranged the code so that my categories display at the top, but your options are limitless for creating an easily-navigated page.
Note this - if you don’t see a dropdown box with various page templates available, it’s either because the theme you are using does not include any, or you’ve mistyped something before uploading.
I hope this helps!








Add A Comment