I’ve been working on a project lately thats really shown me the viability that WordPress has as a CMS platform. While intended as a blog platform, the changing definition of what a “blog” is and contains has really forced the WordPress team to make their platform into a very powerful beast, albeit one with extremely difficult to navigate documentation. In my journey into making a CMS out of a blogging platform I found a lot of great tricks out there. So, if using WordPress as a CMS for your website is something you are considering undertaking, consider this quick list of handy tips.
1. Use posts for everything
Well, not everything per se, but use them for a lot! Store your case studies, projects, even an inventory as posts. I suggest posts over pages as you can easily assign posts to categories and give them tags, giving you good flexibility for filtering and very selective querying. You will also have access to the additional Excerpt field from within the WordPress interface.
Useful Template Tags and Resources for Querying Posts:
- get_posts() – Get a specific set of posts outside of the loop with this method. You can pass a number of parameters to it with the current version of WordPress. Don’t forget to pass the nopaging => true parameter if you want to get back more than 10 results.
- query_posts() – This is the method that is called internally by WordPress to create the default loop. Include this at the top of the page before the loop to filter what gets shown. get_posts() also now uses this method at its core for getting posts in the current version of WordPress. You can also use this page as a reference for the parameters you can pass to get_posts().
- WP_Query() Class for Multiple Loops – Sometimes you will need to call a list of posts within the loop area of a template. This is where WP_Query() class instancing can be immensely useful. This class takes all the same parameters as documented in the query_posts() method, but will only take them serialized in a string (as opposed to an associative array of parameters).
- Order by Custom Fields – Order posts by Custom Field values. This is very useful if you want to assign a custom field to posts to specify a specific order. You can also use this to filter which posts will appear in your query by requiring the presence of a custom field. This is useful for “featuring” elements on a home page.
- Category Templates – Assign templates to entire categories of posts instead of being limited to templates only being useful for pages.
2. Leave pages for overview content
Pages still have their place when utilizing WordPress as a CMS, you just want to stick to using them for overview content. For example, if you are setting up a portfolio and need copy for the listing page, utilize a page entry. Assign a template to this page and use the loop to output the page’s contents. Use an additional loop to loop through the posts that are functioning as the portfolio entries themselves.
3. Take advantage of WordPress’ entry associated galleries
WordPress stores media associated to the post or page that it was uploaded on, whether you have inserted it into the post or not. This is an excellent way of storing gallery images, team member mugshots or portfolio entry thumbnails.
Useful Gallery Plugins and Resources:
- Scissors – A useful, yet cumbersome to use cropping and resizing tool. This tool will also give you access to a fourth media “size” – Large.
- get_children() – Information on getting a post’s associated images/media.
- image_downsize() – Information on getting an attachment’s thumbnail, medium size, or large size variants.