Need to learn how to display blog metadata for your WordPress theme?

Article metadata is relevant information about your post such as date published, category, author name, etc. In this tutorial, we'll show you how to view post metadata on your WordPress theme.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog.

Then, back to why we are here.

What is article metadata?

Article metadata is information about a post that is not part of the actual content. This includes information like the publication date, author, categories and tags, or custom taxonomies.

Depending on your WordPress theme, this information can be displayed on different locations. For example, under the post title, after the post content, on a sidebar column, and more.

This information helps your users learn more about the content they are viewing. If used correctly, metadata can increase pageviews, improve user experience, and make your website more professional.

On the other hand, there is a lot of metadata that can make your website messy.

display blog metadata - site demo wordpress meta data

Depending on your website, you can add or remove information and add custom css styles to make it more useful.

Let's take a look at how to display post metadata in WordPress.

Please note:: This tutorial requires a basic understanding of how the WordPress themes work.

How do WordPress themes display metadata?

There are several ways to view article metadata. Some WordPress themes have a simpler code located below the post title.

Par <?php the_author_posts_link(); ?> le <?php the_time('F jS, Y'); ?> dans <?php the_category(', '); ?> <?php edit_post_link(__('{Modifier}'), ''); ?>

This code simply displays the author's name, publication date, and category (ies).

other WordPress themes can define their own labels, functions, and model classes to display metadata. These functions are then called in the WordPress theme files, responsible for displaying posts.

Usually you will find the metadata code in the file: index.php, single.php, archive.php and your theme's content templates.

You can create a child theme to replace these files. If you create your own custom WordPress theme, you can directly add or modify the code in your existing files.

Let's take a look at some examples of how to display different post metadata in WordPress.

How to display or hide the date of publication in WordPress

To display the publication date of a post, you need to add this code to your WordPress theme.

<p>Cet article a été publié le: <?php the_time('m/j/y g:i A') ?></p>

Note the characters inside the "the_time" function. These are called format characters, and they tell PHP how to format the date and time.

Presentation of date format on wordpress

Do you want to remove dates from your WordPress posts? You will need to locate the code with "the_time" or "the_date" in your WordPress theme files and remove those lines.

See also: How to modify or update the PHP version of WordPress

How to display the latest update date for WordPress articles

If you regularly update old articles on your website, you might want to show the last updated date of your posts. It helps your content re-energize and attract readers who might not read a post that was published years ago.

Just add the following code to the WordPress theme files where you want to display the last updated date:

$u_time = get_the_time('U'); 
$u_modified_time = get_the_modified_time('U'); 
if ($u_modified_time >= $u_time + 86400) { 
echo "<p>Last modified on "; 
the_modified_time('F jS, Y'); 
echo " at "; 
the_modified_time(); 
echo "</p> "; 
}
Display a last modification date of a rticle

How to show or hide the author's name in WordPress

To display the author's name, you need to add the following code to your WordPress theme files.

<p>Cet article a été écrit par : <?php the_author(); ?></p>

This code uses the "the_author" function, which displays only the author's name.

You can also display the author's name and a link to all of these articles. Simply replace the function "the_author" with "the_author_posts_link":

<p>Voir tous les articles de : <?php the_author_posts_link(); ?></p>
View the author of an article on wordpress

If you want to remove the author's name, you will need to locate this tag in the WordPress theme files and delete them.

Read also: How to add copyright on your WordPress blog

How to show or hide categories in WordPress articles

To display the categories, you need to add the following code to your theme files:

<p>This post was filed under: <?php the_category(', ') ?></p>

This code will display the categories of the posts separated by a comma. You can replace the comma with any character you want to use as a separator between category names.

Display the categories of a wordpress article

Another way to display the categories of articles is to display one category at a time. It gives you more control over the style.

For example, you can add the following code:

<?php
$categories = get_the_category( $post->ID );
foreach ( $categories as $category ) {
echo '<span class="bpc-category"><a href="' . get_category_link( $category->term_id ) . '">' .  $category->name  . '</a></span>';
}
?>

Now you can use "bpc-category" CSS class in your custom CSS to categorize category names.

Do you want to remove category names from WordPress posts? You will need to locate the line with the "the_category" function in your WordPress theme files and delete it.

There is a lot more you can do, but this should be taken as a guide for anyone who wants to get started.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. WP Attractive Donations System

This unique premium WordPress plugin allows you to easily and quickly create a beautiful and attractive donation collection system on your website. Each donation collection campaign may have its own steps, amounts, texts, colors, images and support payments via PayPal or Stripe.

Wp attractive donations system easy stripe paypal donations

A donation can be displayed directly on a page, in the form of a button showing the panel on click or in the form of a modal window.

Read also our 10 WordPress plugins to accept donations on your website

With this WordPress plugin you will succeed in inspire your visitors to want to support you using this wonderful and amazing donation collection system.

Download | Demo | Web hosting

2. WP - Quack Chat Live Chat System

Quack Chat is a WordPress extension premium that easily integrates with your website and offers a user-friendly interface for your customers. It is an online chat that can be used from any computer or mobile device.

Quack chat live help support system for wordpress

As functionalities it offers among others: support for instant notifications via messages or emails, an audible notification system, automatic archiving (history) of chats, a user-friendly control panel, a customizable chat window, an automatic and customizable greeting message, support for automatic scrolling on the chat page etc ...

Download | Demo | Web hosting

3. Superfly Menu

Superfly is a responsive menu WordPress plugin that generates vertical, sliding, static navigation, a toolbar or a space saving small screen menu. It can be used as a stand-alone navigation menu or be complementary to your main menu.

Superfly responsive menu wordpress menu plugin

It makes navigation much easier and user-friendly on desktops and mobile devices. The concept of slide in the vertical menu that has proven itself on mobile is also showcased on desktops thanks to this WordPress plugin.

See also 10 WordPress plugins to create sliders on your website

Its support for mouse-over effects eliminates the need for an additional click and reveals the submenu in a appearance modern. Under his hood, only industry best practices have been used to make this plugin fluid and worthy of the name. 

Download | Demo | Web hosting

Other recommended resources

We also invite you to consult the resources below to go further in the grip and control of your website and blog.

Conclusion

Here ! That's it for this tutorial, I hope it will allow you to display blog metadata in your WordPress themes. Feel free to share the tip with your friends on your social networks.

However, you can also consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on WordPress blog creation.

But, in the meantime, let us know your comments and suggestions in the dedicated section.

...