[Resolved] Post meta grouped on top of posts with plain text prefix

Home Forums Support Post meta grouped on top of posts with plain text prefix

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1231997
    ch1800

    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?

    #1232238
    David
    Staff
    Customer Support

    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;
    }
    #1232295
    ch1800

    Simple and efficient!
    Works like a charm and easy to adjust spaces, thanks David!

    #1232301
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.