You might have noticed that I have a post footer section on every one of my posts. What you might not have noticed is that this post footer changes depending on what type of post it is. For example on each of my plugin pages (e.g. SEO No Duplicate plugin), you will see that the footer looks like this:

But on each of my popular articles pages (e.g. Make Any Plugin Work with WP Super Cache), you will see that my footer looks like the following:

Better yet, on any other posts, the footer shows:

In this post I will show you how to easily implement this feature on your WordPress blog.
Overview
You will be doing the following:
- Modifying your theme to recognize a post’s type by looking at the post’s custom fields for a particular key.
- Setting post types for special posts (e.g. plugin pages, popular articles).
Setup
You will need to add the following into your functions.php
function get_custom_field_value($key, $print = false) { global $post; $value = get_post_meta($post->ID, $key, true); if ( $print == false ) return $value; else echo $value; }
When called, this function returns the current post’s custom field value.
Modify your theme
You can add the following code template anywhere in the WordPress loop that you desire this functionality (single.php within “while (have_posts())” works for me).
<?php // Start dynamic section if ( function_exists('get_custom_field_value') ) { if (get_custom_field_value('plugin_page', false)) { // display plugin page stuff here echo "Hello World! This is a plugin page!"; } elseif (get_custom_field_value('article_page', false)) { // display article page stuff here echo "Hello World! This is an article page!"; } else { // display default page stuff here echo "Hello World! This is an ordinary page!"; } } else { // display default page stuff here echo "Hello World! This is an ordinary page!"; } ?>
Note the keys ‘article_page’ and ‘plugin_page’, I will be talking about it in the next section.
Setting post type
All you have to do to set the post type is to open up your post within the WordPress admin and add the custom field key that your theme is expecting (‘article_page’ or ‘plugin_page’ in this case).

Now if you visit that post, you should see the text “Hello World! This is an article page!” in the dynamic section. If you visit any other post, you should see the text “Hello World! This is an ordinary page!” instead.
You can now go through all of your special posts and set their type as they should be set.
What’s next?
I realize that there are a lot better ways to do this sort of dynamic content displaying, but I think this is probably the easiest to implement. Looking forward, I want to look into the ability to be able to display such a dynamic message based on whether the post is in a specific category or whether the post has a specific tag.
I would love to hear what you guys think about this technique. Please don’t be shy to critique and let me know if you have a better solution for this.