How to Display and Style Post Meta Data in WordPress




Geniuswp show

Summary: Have you ever noticed a date or category in a blog post? This is what’s called a ”post meta data” – an important part of a blog post. It helps in providing succinct meta data regarding your blog’s content pieces.If used properly post meta can improve user experience; say a visitor is interested in a certain topic only, then category meta can help them short posts by category so they can view posts on that particular topic rather than see all the posts. Or, if you want to view posts of a particular author only, post meta can help you do that.In this post, I’ll show you how to display and style post meta data.What is Post Meta Data and How Can it Help my Blog?The post meta data section contains relevant information of a blog post such as published date, author name, categories, tags and custom taxonomies etc.If you have a blog then you should make sure your post’s meta data is spot on, as this information can help a visitor understand more about the post and it can also help to increase your page views by making your site easier for navigation.How Much Post Meta Data Should you Display?The post meta data location varies from theme to theme. Some may display it before the post title, some after the title and some right after the content.But too many post meta pieces can mess up the layout. The ideal situation is one in which you would only display the information you feel is necessary.Now let’s see how you can customize and add post meta.Customizing Post Meta DataAs mentioned, the post meta location varies from theme to theme. Here we will work on a particular theme – in this case the default TwentySeventeen theme, so keep in mind that code and pages may be different from your theme.In modern themes post meta are defined in template tags page and called in when required but in some themes you may find post meta is placed directly before or after the post title.Generally, you would find post meta tags in index.php, single.php, archive.php and content template pages.A simple code would look like this:Posted on by This code will display something like this Posted on date by author name with edit button (only if you are logged in the dashboard).But now most modern themes are using template tags page to handle post meta. Let’s see how it works.First, you would have to create a child theme before making any changes.We will work on single post page and this is how it looks from the front-end.Let’s say we want to add a user icon before the author name, to do that do the following:In TwentySeventeen theme, single.php template is used to display single... You are listening to the topic about "How to Display and Style Post Meta Data in WordPress", if you want to read the full article, please visit https://geniuswp.com or the link in the description.