Site logo

Archived topic

Blog Categories Below Date

3 replies · Started by Barbara on January 16, 2018

Viewing posts 1–4 of 4

Hello,

I would like to have the meta data on my single blog posts display Date then Category. Is there a way to flip these?

Hi there,

Give this PHP snippet a try:

add_filter( 'generate_post_date_output', 'tu_add_cats_to_date' );
function tu_add_cats_to_date( $output ) {
    $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );

    if ( $categories_list ) {
        return $output . ' | ' . $categories_list;
    }

    return $output;
}

Let me know :)

I was able to get it to work with this code and a display: block; on the date. Thank you very much for your help!

You're welcome! :)

This archived topic is closed to new replies.