Site logo

Archived topic

(Date) by (Author) – (Categories) in line

12 replies · Started by Milos on September 6, 2020

Viewing posts 1–13 of 13

Thanks David, when I use variant 1, I don't see the categories in that row and the date at the end, would it be possible to do it as I request?

Date - author - category

And I have one more question. Please, as I turn off the display of categories in the next section - for example, below the image in the archive, it will be enough for me to have everything once using a line, thanks a lot.

Try this:

add_filter( 'generate_header_entry_meta_items', function( $items ) {
    if ( is_single() ) {
        // Set meta for single post
        $items = array(
            'date',
            'author',
            'categories',
        );
    } else {
        // Set meta for archives
        $items = array(
            'date',
            'author',
        );
    }
    return $items;
} );

This will set the Meta - Date|Author|Categories for single posts and Date|Author on archives.

Ok, thats good, but how can I remove default location "category"? Now I have it on the web 2x.

You can add this snippet to remove the Categories from the footer meta:

add_filter( 'generate_footer_entry_meta_items', function( $items ) {
    return array_diff( $items, [ 'categories' ] );
} );

Just to be clear.
On the Archive the current layout is correct.
On Single Post you wish to move all the entry meta - Date|Author|Categories to the Footer ?

exactly

Hi there,

Isn't the default for archives "date by author"? Then you can disable the categories by going to Customize > Layout > Blog and un-checking the categories option for single posts.

Then, you should just be able to target single posts like this without the need for any other functions:

add_filter( 'generate_footer_entry_meta_items', function( $items ) {
    if ( is_single() ) {
        $items = array(
            'date',
            'author',
            'categories',
            'post-navigation',
        );
    }

    return $items;
} );

Now is everything very nice bautiful :) thanks

You're welcome :)

This archived topic is closed to new replies.