WordPress as a true custom CMS – plugins and tips

As fellow WordPress developers may know, WordPress became a fully-fledged CMS platform a while ago with the introduction of custom post types and custom taxonomies. So, as well as pages, posts and links, you can create your own content types (such as product, event, real estate listing, recipé, etc) with their own new data items, and work with them in your theme using standard WordPress techniques.

I’m not offering a tutorial here, rather sharing some knowledge and tips I picked up while working on a project that uses 2 custom content types, a custom term taxonomy and also direct links between content types, with metadata attached to the links. However, towards the end of the article I’ll share some of the tutorial and similar links that helped me to get to grips with this game-changing WordPress feature.

Plugins that help you set things up

More Types, More Fields, More Taxonomies!

post-screenshot-moretypesA suite of three fantastically useful plugins. Instead of using the WordPress API to laboriously define your custom post types, custom fields and custom taxnomies in your theme’s functions.php file, simply install these and create your new structures using simple forms in the admin area. You can use each plugin individually, or all three as a seamless single tool.

Now, you may decide that you prefer to define your custom objects manually, to reduce the plugin load on your site, and that’s definitely a laudable goal. However, while you’re learning and experimenting, these plugins make life a lot easier, enabling you to experiment quickly with changes to your custom object definitions with a few clicks of the mouse.

Custom Post Type Archives

post-screenshot-posttypearchivesWordPress may have introduced custom post types, but (until WordPress 3.1 is released at least) there is no facility for a custom archive page in your theme. You know, a page that works like archive.php or index.php by displaying a series of posts, but for your own content types instead.

This plugin fills that gap. You can decide how the URL should be made up, what to include in the page title for SEO purposes, and which custom content types you want to use custom archives for. Very useful indeed while we all wait for the release of WordPress 3.1.

Posts 2 Posts

Note: I wasn’t sure whether to include this plugin in my article, for two reasons: firstly, it requires custom code in your theme’s functions.php file in order to work properly, and secondly it has some bugs which are likely to affect your enjoyment.

However, it performs a function that is crucial in any CMS worthy of the designation, and I haven’t yet found another plugin that does the same thing.

post-screenshot-post2postBut what does it do? Well, let’s say you’re building a comparison shopping site, a bit like Google Product Search (you know, the thing that used to be called Froogle). You have a product, which is available at multiple shops, with a different price in each shop.

With the Posts to Posts plugin, you can link one custom post (like a product) to another custom post of a different type (like a shop), many times over, and you can add pieces of data (like a price) to each link.

Now, this is where it gets hairy.

Firstly, for each link you want to make between post types (for instance “product to shop” or “property listing to agency branch office”), you need to define it in your theme’s functions.php file with an API call. Well, that’s not too bad actually – it’s just something like this:-

function gg_p2p_init() 
	{
	p2p_register_connection_type(array('from'=>'product', 'to'=>'shop'));
	}
add_action('init', 'gg_p2p_init');

However, if you want to store metadata (data attached to a link between content items, not attached to the items themselves), you have to extend one of the plugin’s classes in your functions.php file, and write the admin interface yourself. How to do that is beyond the scope of this article, though the basics are covered in this WordPress support discussion.

And the final piece of hairiness: it has a major bug. When you already have a connection between 2 content items, and you attempt to add another, it loses the first one, and the new one will not have the correct metadata (if you added some metadata fields using the above technique).

After some hours of investigation, I’ve now solved this bug, and on request I can supply a “forked” version of this plugin which does not lose metadata when updating a post. You’ll still have to deal with all the above customisation though.

Plugins that help you display things right

Taxonomy Terms Widget

This works just like the Categories widget – it lets you display a list of terms, with links, which you can obviously style in any way you like.

post-screenshot-recentcustomFor example, if you are building a real estate agency website, you could put a widget area in your site header, and use this widget to display a horizontal menu of property types such as bungalows, apartments, etc.

Recent Post for Custom Post Type

Just like the recent posts widget, except that it lets you list recent products, recent property listings, recent recipés, or whatever content types you may have created. Invaluable.

Links to relevant tutorials

If you’re starting to learn about the world of custom content types and taxonomies, reading tutorial articles is a great way to go. Here are some useful articles on the subject, starting with a couple of excellent starter articles by well-known WordPress expert Justin Tadlock:

Other useful references

For general reference, the WordPress Codex is usually the best place to go, and this topic is no exception.

So, if you’ve stayed with me for this long, I assume you’re interested in using these amazing WordPress features in your own development projects, and I hope that the resources I’ve shared help you to progress with your learning. Feel free to comment, question, or share other resources below.

IMPORTANT

All content on the ZigPress website is copyrighted. You may not republish or syndicate any article or other content without explicit permission.

21 Comments

  1. Wow, this is a great resource – thanks. So far I’ve managed to avoid having to deal with this aspect of WordPress, even though I manage a blog, but I’m sure the time will come.

  2. This new feature of WordPress is really new to me thus I am still not familiar with it. So thanks to your article at least I am not that ignorant about it anymore. Will be bookmarking this so that I can just come back to check if ever I forgot some of those you said.

  3. Very nice article; I consider Wordpress to be the #1 CMS.
    Drupal > Joomla following behind in that order.

    After reading your article, I was surprised at how many features I’ve been missing! And I’ve been using wordpress for a couple years now!
    This should tell people, just how rich and full of plugins and features wordpress has.

    Nice article, will be bookmarking.

  4. Very interesting post, the Taxonomy Terms Widget really helped me.

  5. Awesome list of tutorials! Very nice article

  6. Great article, helped me a lot. Now I’m having the same problem with posts 2 posts as you described. Could you send me your modified code, please?

    Thanks!! Keep it up :)

  7. Hi Clemens, in the end my requirements actually led me to write my own plugin to achieve direct post to post links – you can grab it here: https://www.zigpress.com/wordpress/plugins/zigconnect/

  8. I tried that plugin, but it did not work. The tables weren’t created upon activation. Also, once I made those tables myself, the plugin was not able to create 2 bidirectional links from post type A to post type B (both involved the same types, but need different fields)

    Any thoughts?

  9. I can’t reproduce any failure to create the database tables – perhaps a problem with your MySQL user settings?
    Regarding the inability to create 2 connections between the same content types (to have different fields on each connection), that is by design, though it may be reviewed in the future.

  10. OK thanks for taking the time to think about it. Don’t know either why it did not work, all other plugins just install on my wordpress. (FYI: I’m running 3.0.4).

    But that is what I needed :) as that is interesting, because then you can get closer to actual re-use of components/objects in the database.

  11. As it happens we’ve been using a WP install to develop a real-estate-type site and it’s certainly relatively straightforward to set up. For us the issue seems to be that it’s relatively technical as a CMS if you use custom post types and so on, and it doesn’t feel like the kind of thing you could easily release to a wide range of users without some fairly hefty custom development, and with that the benefit of WP vs a different CMS solution might become marginal. For example, we’ve developed using ModX, which provides a very granular structure ideal for structured content, but it’s not as easy to use as WP…always a compromise!

  12. Nice choice mate, I started using Wordpress recently too, and I’m in love hehe :) The community is great, they help you out immediately. The only small problem I had was finding free themes which are not blogs, to use for some non-profitable websites.

  13. Ryan, I tried to view your website, but I got redirected to a page asking me to install Java… you should probably fix that :)

  14. For me – wordpress is only an option for fairly static sites…

    Joomla is the CMS of choice purely down to the number and quality of 3rd party bolt on components.

    I’ve tried to use wordpress as a directory and a shop, but the fantastic update support with wordpress is offset by the lack of mature component functionality that sadly most of the current 3rd party wordpress components offer….

  15. Thank you very much, the information in this article is very useful.

    Greetings.

  16. Thanks for this info – I just love Wordpress as whenever I need to get it to do something new, there is usually a Plugin to do the job! Thanks for the ‘Recent Post for Custom Post Type’ Plugin as that’s going to be so useful on a new project.

  17. Excellent article about using wordpress as a fully functional CMS platform. Thank you so much for providing links to the plugins for setting it up. I’ll be honest even though I am a website designer with experience these plugins just make everything easier for me. Thanks again!

  18. Some really interesting tips and plug ins there that I did not know of until now. Working on a wordpress for a while now I feel like I know quite a bit but there are so many different ways of doing things and multiple plug ins for similar functions so its working out what suits your requirements best.

  19. Awesome list of tutorials! Very nice article, you are great ;)

  20. Just got started with wordpress. I can’t believe you had all this information 2 years ago. All tutorials are appreciated

  21. I believe that Wordpress is the most powerful cost effective solution for people looking to start up a small business website.