Comments are closed on this article. If you have something to add, please do so on the original article!

A couple of weeks ago, I shared a simple plugin that added a meta box to the post editor dashboard screen that demonstrated how to display post meta data within WordPress. After it was released, I received a few questions as to how one would go about displaying this information on the frontend of a WordPress blog.

That is, how would one go about displaying the post meta data as part of the content for a single post (or post type) in WordPress.

Though I’m not necessarily a fan of doing this, I am a fan of giving other developers practical advice on how to extend existing plugins (using practices used throughout an existing plugin), and I’m also a fan of discussing why I am a fan or not a fan of doing something.

So in my latest article at Tuts+ Code, I did exactly that.

Display Post Meta Data on a WordPress Post

Display Post Meta Data in WordPress

In the article, I discuss the following points:

  • Ramifications of extending the plugin
  • Why publicly sharing data can be a bad idea
  • How to actually extend the plugin

There are two primary takeaways from the article both of which I’ll mention here:

  1. Leveraging existing code can be a powerful thing
  2. Exposing data that is irrelevant to users is a dangerous idea

If you happen to read the article, you’ll see why both of those are my primary points; however, if you’re short on time (or simply don’t want to read the article :), that’s fine. The main reason I wanted to mention those two points if because I think they transcend any given theme, plugin, or other project.

First, leveraging existing code can be a powerful thing, though powerful is a bit of a neutral term. Either you can extend existing code the “right” way by following the standards set forth not only by the foundation on which the existing code is built, but by the practices that the code is already following, or you can simply get something working using your own methodology all the while disrespecting the work someone else has done and making maintenance that much harder.

Secondly, exposing data that is irrelevant to users can be dangerous not only because it may leak how information is stored in the database (which may or may not be dangerous on its own), but it also adds unnecessary noise or jargon to an existing post.

Unless you’re working with a group of technical people on, say, a private blog or a closed intranet, there are very few places in which you may actually want to do something like this.

Because of those two points alone, I’ve got two versions on GitHub:

  1. 1.0.0 is the first version of the plugin which simply introduces the meta box on the dashboard of the post editor.
  2. 2.0.0 is the version of the plugin that introduces the features discussed both in this article and the shared article.

Though there are still some actual changes and improvements that I’d like to introduce to the plugin – and I may end up doing so one of these days – there are other, ahem, pressing (get it? :) matters on which I’m focused at the moment.

At any rate, check out the original article and feel free to share your comments!