[Support request] categories to top, next to author/date

Home Forums Support [Support request] categories to top, next to author/date

Home Forums Support categories to top, next to author/date

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #814182
    albabes

    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

    #814725
    Tom
    Lead Developer
    Lead Developer

    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/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.