Site logo

Archived topic

categories to top, next to author/date

1 reply · Started by albabes on February 18, 2019

Viewing posts 1–2 of 2

I apologize Tom, I asked this of you already, and you answered me already, but I cant find the old post when searching for "categories to top".

Im using theme Child Version: 0.1, and in the "posts page", and the single post page, the CATEGORY is below the content. I'd like it at top, next the author/date meta, same font size.

Thanks
AL

Hi there,

This should do it:

add_filter( 'generate_post_author_output', 'tu_categories_to_author' );
add_filter( 'generate_category_list_output', '__return_false' );
add_filter( 'generate_tag_list_output', '__return_false' );
function tu_categories_to_author( $output ) {
    $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
    $categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
        _x( 'Categories', 'Used before category names.', 'generatepress' ),
        $categories_list
    );

    echo $output . $categories_list;
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

This archived topic is closed to new replies.