How to Show a WordPress Theme’s Post Meta Data

Post meta data is the information displayed associated to a certain piece of content. For example, you’ll see the date a post was published and its author name on many WordPress websites. This information can be used to enhance the user experience while increasing page views through search criteria.

The specific theme you’re using in WordPress will govern over this process. It will control where the meta data is displayed and what contents are added. However, you can change WordPress theme meta data to display more than what’s currently available.

In this tutorial, I’m going to go over a few ways to modify WordPress theme post meta data. It’s a way to improve the way a website appears both to readers and search engines.

What You Need to Know

Because of the nature of themes, it’s difficult to show you exactly what you’ll need to modify. This is because every developer is different and will use their own styles.

Keep in mind that what I show you here may be slightly different than what you’ll see in your theme.

Also, this is going to require a bit of PHP development knowledge. While some adjustments are easily copy-and-paste additions, you may want to learn a bit of PHP before making more intricate changes.

One of my favorite sites for learning website development is W3 Schools. It’s free to use and delivers an excellent user experience even for novice developers.

Using Your Theme’s Customizer

Some themes come with the ability to make changes to the meta data of a post. There may be direct options to make changes or a “Custom CSS” box where you can put in your own CSS coding. To use this properly, you’ll need to know CSS coding.

To find this feature in WordPress, go to the Appearance area and click, “Customize.”

Customize

This is where it might be a bit confusing. Because each theme developer is different, you’ll have a completely separate set of tools for each layout. In my example, I’m using the ColorMag theme. In the left panel, I have a tool called, “Additional CSS.” This is the function to use to make adjustments to the meta data.

Meta Data CSS

However, you might actually have tools specifically for modifying the meta data of posts. For instance, the HitMag theme gives you meta data check boxes in its “Post Options” tool.

HitMag Meta Data

Before you proceed to editing PHP, it’s a good idea to check the capabilities of your theme through the WordPress Customizer. You may find easier options than manually altering the code of your site’s layout.

Editing Your Theme’s PHP

One of the best ways to customize your meta data is through editing the site’s PHP files. This gives you absolute control over what elements you want to change. However, it also requires a bit of PHP coding knowledge.

Let’s get started.

Create a Backup of Your Site

Any time you make any changes to your site, especially while coding, make a backup. Accidents happen, and you don’t want your site to be disabled because of faulty coding somewhere. A backup will help you recover quickly in the event of any problems.

And it’s always a good idea to have a backup on hand, anyway.

Create a Child Theme

When you want to make edits to a theme’s code, it’s always best to use a child theme instead. Child themes gain all the benefits from their parents with the exception that they are not overwritten during an update.

Any file placed into the child theme overrides the parent’s file. This means you do not need an entire copy of the theme you want to edit, just the one file. In this instance, we are going to edit the “single.php” file. This is what most themes will use when displaying a post to a visitor.

NOTE: Remember, not all themes are created equal. While the single.php file is quite common, some developers may use a different name. You’ll have to make sure you’re editing the correct file for this to work.

Know the Elements of Your Theme

Before you can effectively make changes to your WordPress theme, you need to know the elements that are used within it. For example, not all themes will make use of the “the_author_posts_link” property. So trying to use it in your website would result in a blank space.

What does this mean? It means you need to spend time going through the CSS and PHP layout of your theme to know what sections are being used and what you can add to make your coding work.

This is why I suggest learning more about PHP development before trying to make adjustments in your theme. Placing a line of code on the wrong line could result in a page suffering an error.

Error Image

Editing the WordPress Theme Post Meta Data

I’m going to assume you created a single.php file under your child theme. If not, you can surely edit your theme’s primary file. Just be aware that any changes you make might be removed if an update is published which makes changes to that specific file.

Click the “Single Post” file from the right under your selected theme.

Single Post

Here is where knowing PHP will come into play. Where you make your adjustments will impact the post. Placing code directly under the “get_header” portion will show the meta data before the content. If you place it under the “get_template_part( ‘content’)” section, it will show after the content.

Meta After Content

Depending on how the theme is set up, the post’s meta data will be accessible in the single.php file. From here, you can add tags, text, categories, author information and more. While it may take a bit of trial and error to find the right spot, it may help boost the website’s performance.

Customize Your Website

One of the great things about WordPress is you don’t have to know PHP or CSS to build a nice website. However, these two languages are quite useful when you want to fine-tune everything from post meta data to how the site pulls information. Experiment with making the layout your own, but be mindful of your changes. The wrong bit of code could render your site inoperable.

What kind of code changes have you made in WordPress? What’s your favorite plugin for making operational changes?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.