Michał 'Doctor' PawełczykWebdesigner/Webdeveloper

WordPress blog page with a changeable layout

Sometimes we need to change the the layout of our blog’s post list or archive page. Or we want to give this possibility to the users of our new shiny premium WordPress theme. Reasons may vary, but sooner or later we seek a solution that will let us do what we want and be maintainable and easy to develop in the future.

The idea

Our changeable layout solution will have to meet the following criteria:

  • easy to use by any WP site admin (even those with no web-related knowledge)
  • easy to improve if we want to develop it further in the future
  • maintainable
  • elegant (no dirty hacks!)
  • professionally looking (like a built-in WordPress feature, not a special custom-made admin panel inside the admin panel)

So, the general idea will look like this: we’ll use the WordPress Customization API to select layout and we’ll create several post templates to include in the post list based on the layout we choose.

For this article I chose these layouts:

  • default post list
  • post list with exposed date
  • post grid

These layouts will cover the problem of changing a single post list item layout and the whole page layout (the post grid will look different and will have no sidebar).

Of course you can customize it if you wish by adding more layouts.

Comments are currently closed.