Archived topic
Post meta grouped on top of posts with plain text prefix
3 replies · Started by ch1800 on April 8, 2020
By default, most post meta (date, author, etc) are displaying at top of single posts but the category to which the post belongs goes at the bottom of the post.
In order to group them all together on top, David provided this snippet that works just fine:
add_filter( 'generate_header_entry_meta_items', function( $items ) {
if ( is_single() ) {
$items = array(
'categories',
'date',
);
} return $items;
} );
The only thing is that it is not clear what “internet” means right in front of a date when you have a category called "Internet" for instance and I would like to add a plain text prefix, like “category: Internet” and then “publication date: xxx”.
Is there a way to add prefixes in plain text in front of 'categories' and 'date' above?
Hi there,
simplest way is this CSS:
.single .cat-links a:before {
content: 'Category:';
margin-right: 1ch;
}
.single .entry-meta .posted-on a:before {
content: 'Publication Date:';
margin-right: 1ch;
}
Simple and efficient!
Works like a charm and easy to adjust spaces, thanks David!
You're welcome