[Resolved] Entry Meta Author

Home Forums Support [Resolved] Entry Meta Author

Home Forums Support Entry Meta Author

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

    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)

    #750854
    Tom
    Lead Developer
    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?

    #750926
    Ian

    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 ‘)’

    #750980
    Ian

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

    #751107
    Tom
    Lead Developer
    Lead Developer

    Sorry about that! Can you try now?

    #751132
    Ian

    That did the trick, thanks.

    #751550
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

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