[Support request] Problem adding author picture under blog post title

Home Forums Support [Support request] Problem adding author picture under blog post title

Home Forums Support Problem adding author picture under blog post title

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #1342593
    Benjamin

    So I have this in Code Snippets:

    add_filter( 'generate_post_author_output', function( $output ) {
        if ( ! is_singular() ) {
            return $output;
        }
    
        return sprintf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
                esc_html( get_the_author() ),
                get_avatar( get_the_author_meta( 'ID' ) )
            )
        );
    } );
    
    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'comments-link',
            'date',
        );
    } );

    And this in “additional CSS”:

    .posted-on .updated {
         display: inline;
     }
     .posted-on a time:nth-child(2) {
         display: none;
     }
     .posted-on a time:first-child:before {
         content: "Updated: ";
     }
     .posted-on a time:last-child:before {
         content: "Published: ";
     }
    
    .byline img {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        position: relative;
        vertical-align: middle;
        margin: 0 10px 0 0;
    }
    
    .comments-link,
    .posted-on {
    	border-left: 1px solid #ddd;
    	padding-left: 10px;
    	margin-left: 10px;
    }
    
    .single .comments-link {
        display: inline-block;
    }
    #1342843
    Leo
    Staff
    Customer Support

    So is the issue that it’s showing twice in archives, one on top and one at the bottom?

    If so which one would you like to remove?

    #1343547
    Benjamin

    Sorry, I should have been clearer.

    Yes. And I would like to remove the one under the excerpt and category on archive pages (so the bottom one).

    #1343781
    Leo
    Staff
    Customer Support

    Try adding an additional filter:
    https://docs.generatepress.com/article/generate_footer_entry_meta_items/

    And just choose the items you want in the footer.

    Let me know if this helps 🙂

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.