Archived topic
Single post meta customization
5 replies · Started by George on November 3, 2020
I want to display my post meta like the example attached.
Like Example 2 from this article but add the category in the form of: [POST AUTHOR] in [CATEGORY] (or multiple categories separated by commas).
I know I have only posted that yesterday and I am sorry to be asking that but it's quite critical and I need to finish it today. Is it possible?
Thank you!
It may be worth completely stopping GP from outputing the standard meta, and adding it yourself:
add_filter( 'generate_header_entry_meta_items', '__return_empty_array' );
add_action( 'generate_after_entry_title', function() {
?>
<div class="entry-meta entry-meta-container">
<div class="entry-meta-gravatar">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
</div>
<div class="entry-meta-info">
<div class="entry-meta-author">
<?php generate_do_post_meta_item( 'author' ); ?> in <?php generate_do_post_meta_item( 'categories' ); ?>
</div>
<div class="entry-meta-date">
<?php generate_do_post_meta_item( 'date' ); ?>
</div>
</div>
</div>
<?php
} );
Then your CSS:
.entry-meta-container {
display: flex;
align-items: center;
}
.entry-meta-gravatar {
margin-right: 10px;
}
.entry-meta-gravatar img {
width: 50px;
}
.entry-meta-info {
display: block;
}
Hi Tom, thanks for getting back.
Ok, it almost works, I can add border-radius to the image. I would like to remove the "by" before the author's name and add "Last updated: " after the date.
I would imagine, I would use the :before pseudo element for the "Last updated: " text.
Hi, Tom. I used the code found on this post to remove the by from author.
All good now, thank you!
No problem! :)