Creating custom blog page template the right way

Don’t forget that WordPress was primarily designed to be a blogging CMS, so when it comes to theme development, developers often opt for a non-standard approach in exchange for the potential for more features.

Theme developers have three options when they approach this, one of which (#2 below) you mentioned.

  1. Directly edit the index.php to modify the blog index. This is not a good option because index.php should be the a fallback in case another part of your template is missing.

    • Pros: fast and easy
    • Cons: error prone and against object oriented principles
  2. Create a page template for the blog index. Like you said, many theme developers elect to go this route because it’s a fast way to give you control over the blog index, and it actually gives you the ability to play around with different blog index templates (which is useful when developing a versatile theme).

    • Pros: Versatile, allows for building a robust theme
    • Cons: you lose the ability to call WordPress’ native functionality that pertains to the blog index.
  3. Create a front-page.php, home.php and index.php in your theme. The front-page will be the home page for the theme. home will default to your blog index and index will be your fallback for all templates.

    • Pros: Clean and makes full use of WordPress’ native objects and methods
    • Cons: Limited by WordPress: not ideal for many of the kinds of option-rich themes you see today

Personally I like to go with #2, because most of my WordPress development projects these days are not just blogs: they’re entire sites with deep information architecture and complex interactivity.

Leave a Comment