🎉 Happy 4th of July! Get 15% off GP Premium with the discount code: 4THOFJULY2020

[Support request] how to add last updated and author name with gravator without plugin

Home Forums Support how to add last updated and author name with gravator without plugin

  • This topic has 1 reply, 2 voices, and was last updated 6 months ago by Leo.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1124133
    sanu kumar

    how to add last updated and author name with gravatar without a plugin.

    Currently, I am using this PHP:

    add_filter( ‘generate_post_author_output’, function() {
    return sprintf( ‘ <span class=”byline”>%1$s</span>’,
    sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person&#8221; itemscope=”itemscope” itemprop=”author”>%4$s<span class=”author-name” itemprop=”name”>%3$s</span></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’,
    );
    } );

    add_filter( ‘generate_footer_entry_meta_items’, function( $items ) {
    return array(
    ‘date’,
    ‘categories’,
    );
    } );

    I have added this code in code snippets plugin…but I want to know is there any other method without plugin..If so, then could you tell me, because I don’t want more plugin on my site.

    Thanks

    #1124141
    Leo
    Staff
    Customer Support

    Hi there,

    Code snippets really shouldn’t slow down your site at all – it’s simply a way for you to add code.

    You can do a speed test with and without Code Snippets to see if there are any effects at all.

    The other option is to use a child theme:
    https://docs.generatepress.com/article/adding-php/#use-a-child-theme

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