Wordpress Tutorial: Displaying metadata in your theme !

in #utopian-io7 years ago (edited)

Displaying metadata

Trying to figure out how to display key information about your posts on WordPress, so your visitors can easily find them? Or maybe to add that professional touch to all your site? Let this article be your guide. We will walk you through the entire process and you will be able to call yourself a “Metadata Champ” in no time. Do read on…

What is Post Meta data?

Metadata is basically the administrative information related to every post you publish on WordPress. This data is usually not part of the content itself but contains relevant information about the post like the date it was published, the author, categories, relevanttags, and other key information specific to the post. Most
of the time, this information is placed right next to the post, although it can be tweaked to display in any part of the page, all depending on your WordPress theme.

How do I make Post Meta data information display in WordPress?

Based on the theme you use for your WordPress there are several ways to do this. Basically, metadata information is displayed using a few lines of code in your site but no worries, you don’t need to be a web
developer to be able to do it as you can basically use templates. For example:

Screen Shot 2017-12-16 at 9.22.44 PM.png

This code displays the author name, date, and category of the post.

The basic WordPress theme places post meta data basic information and tags below your post in a box, before the comments.

Depending on your theme you choose, this arrangement can differ, but you should be able to find all the templates for displaying post meta data under the theme’s index.php, single.php, archive.php. You may also create a custom theme to easily add or edit code in your theme files.

Let’s see some examples of how to display various post meta data in WordPress.

  • Displaying your Date for WordPress posts: You can display the '’last updated’’ date by copying and pasting this code to your WordPress theme file:

Screen Shot 2017-12-16 at 9.24.37 PM.png

  • And it will give you this result:
    Screen Shot 2017-12-16 at 9.25.54 PM.png

Display or Hide Author name

To display the author’s name, copy and paste this code into your theme files:
Screen Shot 2017-12-16 at 9.33.26 PM.png

To link the author’s name to all posts they wrote use:
Screen Shot 2017-12-16 at 9.34.07 PM.png

  • The result is:
    Screen Shot 2017-12-16 at 9.28.07 PM.png

How to Show or Hide Categories in WordPress Theme

To show a category, copy and paste the following code into your theme files:
Screen Shot 2017-12-16 at 9.34.49 PM.png

This creates the categories and separates them with a comma. You can use any other character of your choice as a separator to improve the aesthetics of your site.
Screen Shot 2017-12-16 at 9.32.04 PM.png

To hide a category, add this code to your theme files simply locate the line with a the_category tag in your theme files and delete.

Display Post Tags

To display post tags, simply add this code to your theme files:
Screen Shot 2017-12-16 at 9.35.33 PM.png

And there you have it. The basic tweaks you can make to add metadata to your WordPress themes.

You may explore more by using '’custom themes’’ to add your own metadata to your theme files after you master the basic ones.

Happy learning!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @osblog I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x