Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
How To Display Post Meta Data on a WordPress Post
Jul 11, 2014 @ 15:44:41

NetTuts.com has a a recent tutorial showing you how to show the metadata from a posting in WordPress right along with the other post data.

During the course of the series, one of the things that we did in order to help demonstrate the object-oriented principles as well as some of the features of the WordPress API was build a plugin. Specifically, we built a plugin that allowed us to view all of the post meta data associated with a given post within the WordPress dashboard. [...] Since that particular post was written, I've received a number of different questions one of which has been how do we take the data displayed in the dashboard - that is, the post meta data - and display it on the front end of the web site. In this article, we're going to take a look at extending the plugin such that we can display the data on a single post page.

To display the data, they actually extend the plugin they've already made. They start with some of the issues of this method (and the data itself) that you might run into during the development. They create a "public" directory to store the cached metadata in and a manager class to handle the functionality. The class loads the data and uses output buffering to capture the data. A public hook is defined to call the "display" action on each page load and the results are passed out to the view.

tagged: wordpress metadata plugin extend tutorial action

Link: http://code.tutsplus.com/tutorials/how-to-display-post-meta-data-on-a-wordpress-post--cms-21658


Trending Topics: