My last ten or so projects I have been working on all have a common theme: maximize WordPress’s ability to be a powerful CMS. Clients more and more are coming to me with the need to create a custom fields which they can store/query data throughout their site.
WordPress is completely customizable and because of this – it is easy to add custom fields to any post or page and then use the data put in them throughout the page.
Example: You have all your clients listed on your web site – and have created profile pages for them. Not only do you want to show their profile – you would really like to have a page template that shows all your client logos – and does so dynamically so that anytime you add a new client – their logo gets added to the mix automatically. The examples are endless and the solution is easy.
Step 1: Create a custom fields plugin (or use the generic custom fields) – personally I like to create a plugin so that I can completely customize and make adding content as easy as possible. If there is interest – I can cover how to create a plugin.
Step 2: Now that your data is stored – you can use it anywhere you want (in the loop, outside the loop). You can use something like:
ID, $key, true);?>
to display the data. (see Using Custom Fields for more information).
Step 3: Again – now that the data is stored – you can also query it so if you wanted to show all logos (as mentioned above) – you can do so by using WordPress’ query_posts to query and then display the data. (see Query Posts for more information).
Stuck? Interested? Let me know.