Celebrating 5 Years! Get 25% off GP Premium with the discount code: CELEBRATING5

[Resolved] Entry Meta Author

Home Forums Support Entry Meta Author

This topic contains 6 replies, has 2 voices, and was last updated by  Tom 5 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #750241


    How can I move the author directly below and grouped with the other meta as shown in the screenshot. Author would be below the category.

    I would also like to add the word, Category: (before the taxonomy)
    The word, Tagged: (before the tab)
    The word, Previous Post: (before the next post meta)
    The word, Next Post: (after the next post meta)

    GeneratePress 2.2.1
    GP Premium 1.7.5

    Tom Lead Developer

    Hi there,

    You can add the author below the category like this:

    add_filter( 'generate_post_author', '__return_false' );
    add_filter( 'generate_category_list_output', function( $output ) {
        echo $output;
        printf( ' <span class="byline">%1$s</span>', // WPCS: XSS ok, sanitization ok.
            sprintf( '<span class="author vcard" %5$s>%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
                __( 'by', 'generatepress' ),
                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                /* translators: 1: Author name */
                esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
                esc_html( get_the_author() ),
                generate_get_microdata( 'post-author' )
    } );

    The others are possible as well but it’s not possible to add the words before the icons. It would be easiest to replace the icons with the text if that works for you?



    Getting the following error and when I copy your code it looks like I can’t copy the bottom line?

    The code snippet you are trying to save produced a fatal error on line 14:

    syntax error, unexpected ‘)’



    Copied the code but tells me it’s missing a bracket.


    Tom Lead Developer

    Sorry about that! Can you try now?



    That did the trick, thanks.


    Tom Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.