How to Display Blog Post Meta Data in WordPress Themes
Do you wish to learn to show put up meta knowledge in your WordPress weblog posts?
Meta knowledge consists of necessary details about your posts, such because the publication date, the creator’s identify, and the tags. Generally, guests might must know this info.
On this article, we are going to present you the best way to show put up meta knowledge in WordPress posts simply.
Why Show Weblog Submit Meta Knowledge on Your WordPress Web site?
Weblog put up meta knowledge is details about a put up that’s not half of the particular content material. It consists of issues just like the publication date, the identify of the creator in case you are working a multi-author WordPress blog, categories and tags, customized taxonomies, and extra.
This meta knowledge can seem in numerous totally different places, relying in your WordPress theme.
Wherever it seems, meta knowledge may also help guests be taught extra about your content material. It could additionally assist them uncover different attention-grabbing posts. For instance, they could search for extra blogs written by the identical creator.
On this method, put up meta knowledge can enhance the consumer expertise and should even increase pageviews. Simply watch out about displaying an excessive amount of put up meta knowledge, as it could possibly make your web site look messy and complicated.
With that being stated, let’s see how one can show put up meta knowledge in WordPress themes. Merely use the short hyperlinks beneath to leap straight to the tactic you wish to use:
Technique 1: Utilizing the WordPress Theme Customizer (Simple)
Some themes mean you can customise the put up meta knowledge with out writing any code.
To examine whether or not that is the case on your theme, simply go to Look » Customise, which opens the WordPress theme customizer.
Now you can search for any settings that mean you can customise your weblog pages. These will usually be labeled ‘weblog,’ ‘weblog settings,’ ‘posts’ or comparable.
For instance, in case you are utilizing the Astra WordPress theme, then you’ll be able to merely choose ‘Weblog’ from the left-hand menu.
After that, click on on ‘Weblog / Archive.’
Merely scroll to the ‘Meta’ part to see all of the totally different knowledge you could add or take away.
So as to add meta knowledge to your web site, simply click on on its ‘present’ icon, which seems to be like an eye fixed.
To take away a bit of meta knowledge, click on on the icon once more.
You may as well change the order that WordPress exhibits this meta knowledge to guests utilizing drag and drop.
As you make adjustments within the theme customizer, the dwell preview will replace mechanically, so you’ll be able to attempt totally different settings to see what seems to be one of the best on your WordPress website.
When you find yourself proud of how the put up meta knowledge seems to be, don’t neglect to click on on ‘Publish’ to make your adjustments dwell.
Even for those who don’t see any put up meta knowledge settings within the WordPress customizer, there should be a method so as to add this info with out writing code.
With that in thoughts, we suggest trying on the theme’s documentation. You may as well attain out to the theme’s developer for assist.
For many helpful ideas, please see our information on how to properly ask for WordPress support and get it.
Technique 2: Utilizing the Full-Web site Editor (Block Themes Solely)
If you’re utilizing a block-based theme like Hestia Pro, then you’ll be able to show put up meta knowledge wherever in your web site utilizing the Submit Meta block.
To get began, simply go to Themes » Editor within the WordPress dashboard.
By default, the full-site editor will present your theme’s house template.
So as to add the meta knowledge to your WordPress weblog posts, go forward and click on on ‘Templates’ within the left-hand menu.
The editor will now present an inventory of all of the templates that make up your WordPress theme.
Merely click on on the Single template, which controls the structure of your weblog posts.
WordPress will now present a preview of the Single web page template.
To edit this template, go forward and click on on the small pencil icon.
With that finished, click on on the blue ‘+’ icon within the high left nook.
Within the search bar that seems, kind in ‘Submit Meta.’
When the proper block seems, drag and drop it onto your weblog structure.
By default, this block will present the put up’s classes, creator, and tags.
It’s possible you’ll wish to edit this meta knowledge. For instance, you may delete the tags or change the static textual content that WordPress exhibits earlier than the meta knowledge.
The next picture exhibits an instance of how the default Submit Meta block will look in your WordPress blog.
To alter this block, merely click on to pick out it within the full web site editor. You may then click on on any block throughout the Submit Meta block and make your adjustments.
Simply pay cautious consideration as to if you might be modifying the static textual content that WordPress exhibits in entrance of the meta knowledge or the dynamic textual content that WordPress will exchange with actual values.
For instance, within the following picture, we’ve got added some static textual content to the Submit Creator part.
Nevertheless, we haven’t modified the ‘Submit Creator’ dynamic textual content.
Within the following picture, you’ll be able to see how it will look in your WordPress weblog.
You may additionally wish to add extra meta knowledge to the Submit Meta block.
For instance, the complete web site editor has blocks, reminiscent of Submit Date and Submit Creator Biography, you could simply add to the Submit Meta block utilizing drag and drop.
Merely click on on the blue ‘+’ button after which discover the block that you simply wish to use. You may then drag and drop it onto the Submit Meta block.
If you happen to add extra blocks to the Submit Meta block, then you could want to alter its structure.
To do that, merely click on on the Submit Meta block after which choose the ‘Block’ tab.
Now you can use these settings to rearrange the content material in a pleasant structure. For instance, you may change the variety of columns or add margins and padding.
When you find yourself proud of how the Single template seems to be, click on on the ‘Save’ button.
Now for those who go to your web site, you will note the put up meta knowledge in motion.
After that, you could wish to add put up meta knowledge to different areas of your web site, reminiscent of your custom archive page.
To do that, merely open the complete web site editor by following the identical course of described above.
You may then choose ‘Templates’ from the left-hand menu and select the template you wish to edit.
After that, you’ll be able to add put up meta knowledge following the identical course of described above.
Technique 3: Making a Customized WordPress Theme (Absolutely Customizable)
Another choice is to create a customized WordPress theme. It is a extra superior methodology, but it surely offers you full management over the place the put up meta knowledge seems in your web site.
Prior to now, you would wish to comply with difficult WordPress tutorials and write code to construct a customized WordPress theme. Nevertheless, it’s now attainable to create your individual themes with out writing a single line of code utilizing SeedProd.
SeedProd is the best drag and drop WordPress page builder and in addition comes with a theme builder. This lets you design your individual themes utilizing a easy drag and drop editor.
For step-by-step directions, please see our information on how to create a custom WordPress theme (without any code).
After that, you’ll be able to add put up meta knowledge to any a part of your WordPress web site. Merely discover the ‘Submit Data’ block in SeedProd’s left-hand menu.
Now, drag and drop the block onto your web page structure.
After that, click on to pick out the Submit Data block. By default, this block exhibits the creator, date, time, and feedback meta knowledge.
Nevertheless, you too can present the modified date, modified phrases, and phrases meta knowledge.
So as to add extra info to the block, merely go forward and click on on ‘Add Merchandise.’
This provides a brand new placeholder merchandise.
Now, go forward and click on on the merchandise to see all its settings.
Now, open the ‘Kind’ dropdown and select the kind of meta knowledge you wish to show.
Relying on the choice you select, you’re going to get entry to some further settings. For instance, for those who chosen ‘Modified Time’, then you’ll be able to select the time format.
You may as well change the icon that SeedProd makes use of for the meta knowledge merchandise. Merely open the ‘Icon’ dropdown after which select ‘Customized.’
You may then go forward and click on on ‘Select Icon.’
This brings up the icon library with a whole bunch of icons to select from. You should utilize the search bar to search for a particular icon or flick through your entire checklist.
Once you discover a picture you wish to use, merely hover over it after which click on the ‘Plus’ button so as to add it to your web page.
Do you wish to take away a meta knowledge merchandise as an alternative?
Then merely hover your mouse over it after which click on on the trash can icon when it seems.
Lastly, you’ll be able to change the order of the meta knowledge objects utilizing drag and drop.
When you find yourself proud of how the Submit Data field is ready up, you could wish to change the way it seems to be by deciding on the ‘Superior’ tab.
Right here, you’ll be able to change the spacing, add a border, and even add CSS animation effects.
When you find yourself proud of how the web page seems to be, simply click on the ‘Save’ button after which select ‘Publish’ to make it dwell.
Technique 4: Modifying Your Theme Recordsdata (Superior)
You may as well add meta knowledge utilizing code. This methodology is extra superior, but it surely means that you can management precisely what meta knowledge WordPress exhibits to guests and the place that info seems in your web site.
If you happen to haven’t added code to your web site earlier than, then take a look at our step-by-step information on how to copy and paste code in WordPress.
You may modify the person theme information straight, however this makes it tough to update your WordPress theme without losing customization. For that reason, we suggest overriding the theme information by creating a child theme.
If you’re making a customized theme, then you’ll be able to add or modify the code in your present theme information.
There are many methods to show put up meta knowledge in a WordPress theme. Some themes may have easy code that’s situated beneath the put up title, as you’ll be able to see within the following instance:
By <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y'); ?> in <?php the_category(', '); ?> <?php edit_post_link(__('{Edit}'), ''); ?>
The code above merely shows the creator’s identify, put up date, and classes.
Different themes might use their very own template tags, features, and courses to point out meta knowledge. Then, the theme information which might be answerable for displaying posts can use these features.
Normally, one can find put up meta knowledge code in your theme’s index.php
, single.php
, archive.php
, and particular person content material templates reminiscent of single-layout.php.
If you’re not sure the place to look, then please see our beginner’s guide to WordPress template hierarchy.
Now we’ve got lined that, let’s check out some examples of the best way to show totally different put up meta knowledge in your WordPress weblog.
Show or Conceal Submit Date in WordPress
To show the put up’s publication date, you have to add the next PHP code to your theme:
<p>This text was revealed on: <?php the_time('m/j/y g:i A') ?></p>
This code merely exhibits the time and date once you revealed the put up.
Pay particular consideration to the characters inside the_time
perform. These are referred to as format characters, and so they inform PHP the best way to format the date and time.
If you wish to cover the date meta knowledge at any level, then merely discover the code with the_time
or the_date
features in your theme information and delete these strains.
Show the Final Replace Date for WordPress Posts
By updating outdated articles, you’ll be able to maintain your web site contemporary and attention-grabbing and enhance your WordPress SEO.
If you happen to commonly replace outdated content material, then you could wish to present the date when a put up was final up to date. This may make your content material appear extra related and attention-grabbing to guests, who might not be all in favour of posts that had been revealed years in the past.
Fortunately, it’s tremendous straightforward to show the final replace date for WordPress posts utilizing WPCode. It’s the finest code snippets plugin that means that you can edit your theme information with out writing code.
For detailed directions, please see our full information on how to display the last update date of your posts in WordPress.
To show the author name, you have to add the next code to your theme information:
<p>This text was written by <?php the_author(); ?></p>
This code makes use of the_author
tag, which exhibits the creator identify solely:
Generally, guests might wish to learn extra posts by their favourite creator. With that in thoughts, you’ll be able to hyperlink to the creator’s web page by changingthe_author
tag with the the_author_posts_link
, as proven within the code beneath:
<p>View all articles by <?php the_author_posts_link(); ?></p>
If you wish to cover the creator’s identify at any level, then merely discover the the_author
or the_author_posts_link
tags in your theme information and delete them.
Present or Conceal Classes in WordPress Posts
Classes may also help readers discover associated content material, which is able to enhance the consumer expertise and maintain them in your web site for longer.
You may present the classes meta knowledge utilizing the next code:
<p>This put up was filed underneath: <?php the_category(', ') ?></p>
Within the following picture, you’ll be able to see how the classes will look to your readers:
As you’ll be able to see, the code exhibits all of the put up’s classes separated by a comma. You may exchange the comma with any character you wish to use by modifying the code snippet above.
If you wish to take away class meta knowledge out of your WordPress posts, then simply discover the road with the_category
tag in your theme information and delete it.
Much like classes, tags may also help guests discover extra content material they’re all in favour of studying.
To point out the tags put up meta knowledge, merely add the next code to your theme information:
<p>Tags: <?php the_tags(); ?></p>
This code will present all of the put up’s tags separated by a comma.
You may exchange the comma with any character you need. For instance, right here, we’re displaying tags separated by a slash.
<?php the_tags( 'Tags: '/ ', ', '<br />' ); ?>
As you’ll be able to see, the_tags
perform accepts three totally different values, often called parameters.
the_tags($earlier than, $separator, $after)
You should utilize the earlier than and after parameters so as to add any textual content or code that you simply wish to present subsequent to the tags. This lets you add CSS courses after which use them to alter how the tags look in your web site.
Let’s check out an instance:
<?php the_tags('<div class="wpb-tags">Tags: ', ' ', '</div>');
If you wish to cover the tags out of your readers at any level, then discover the road with the_tags() code in your theme information, and delete it.
If you’re comfy including customized code to your WordPress web site, then you’ll be able to present much more meta knowledge to your guests.
For instance, you should use custom fields so as to add your individual meta knowledge to WordPress posts. Another choice is to create custom meta boxes to show the customized fields.
We hope this text helped you learn to show weblog put up meta knowledge in your WordPress themes. You may additionally wish to see our information on how to create a landing page with WordPress or see our knowledgeable picks for the best landing page plugins.
If you happen to appreciated this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You may as well discover us on Twitter and Facebook.