[Support request] Show Author Image and Date on HomePage, Archive Pages, Category and Tags

Home Forums Support [Support request] Show Author Image and Date on HomePage, Archive Pages, Category and Tags

Home Forums Support Show Author Image and Date on HomePage, Archive Pages, Category and Tags

Viewing 15 posts - 1 through 15 (of 53 total)
  • Author
    Posts
  • #1349042
    Ravi Saive

    Hi Team,

    I want to show the only author’s image, name, and date as shown in this example: https://prnt.sc/ta8w59.

    I also added an example link in the URL here: http://maxify.themerex.net/home-2/

    #1349345
    David
    Staff
    Customer Support

    Hi there,

    as per your other topic – can you create a staging site so we can see what you have already – then we can assist with making these changes.

    #2481500
    Ravi Saive

    @David,

    I just want to display the author’s image with name and date at the right and comment count on the left side of the homepage posts…

    See the information in the private..

    #2481525
    Fernando
    Customer Support

    Hi Ravi,

    Can you try adding this Snippet first?:

    add_filter('generate_header_entry_meta_items', function($output){
    	if(is_home() || is_archive() ){
    		return array(
    			'author',
    			'date',
    			'comments-link'
    		);
    	}
    	return $output;
    }, 10);
    
    add_filter( 'generate_post_author_output', 'tu_add_author_gravatar' );
    function tu_add_author_gravatar() {
    	printf( ' <span class="byline">%1$s</span>',
    		sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%5$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' ) ) ),
    			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_action( 'wp', function() {
        if ( is_home() || is_archive() ) {
            add_filter( 'generate_show_comments', '__return_true' );
        }
    } );
    

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    We’ll see what CSS is needed afterward.

    #2481556
    Ravi Saive

    @Fernando,

    The code is working fine, but it should display the below excerpt without background inline color on the homepage… Also, it should display only the date, not the last updated text. The comments count not showing on the left side in the homepage…

    #2481564
    Fernando
    Customer Support

    Can you re-add the code so we can see it live and assess what to do next? If you have a staging site, you can add it there first, and we can go from there.

    #2481572
    Ravi Saive

    @Fernando,

    I have added the code to the live site…

    #2481582
    Fernando
    Customer Support

    I updated the code above. Can you update yours?

    We’ll proceed with the CSS once we get the comment count to show.

    Don’t worry about the “updated date”, we can fix that with CSS as well.

    #2481588
    Ravi Saive

    @Fernando,

    I have updated the code, but still showing above the excerpt, it should show below with the separator hr tagline…

    #2481856
    Ravi Saive

    Waiting for your update..

    #2481984
    David
    Staff
    Customer Support

    Hi there,

    change:

    add_filter('generate_header_entry_meta_items', function($output){
    	if(is_home() || is_archive() ){
    		return array(
    			'author',
    			'date',
    			'comments-link'
    		);
    	}
    	return $output;
    }, 10);

    To:

    add_filter('generate_footer_entry_meta_items', function($output){
    	if(is_home() || is_archive() ){
    		return array(
    			'author',
    			'date',
    			'comments-link'
    		);
    	}
    	return $output;
    }, 10);
    #2482082
    Ravi Saive

    @David,

    The given code shows meta tags twice see attached screenshot link.

    #2482415
    David
    Staff
    Customer Support

    Go to the Customizer > Layout > Blog, and on the archive tab, uncheck the post meta options for date and author. This will remove the top line.

    #2482431
    Ravi Saive

    @David,

    I tried that, but when I uncheck nothing showed, but when I check back it shows twice…

    #2482860
    Fernando
    Customer Support

    To clarify, is this the only code you have now for this?:

    add_filter('generate_footer_entry_meta_items', function($output){
    	if(is_home() || is_archive() ){
    		return array(
    			'author',
    			'date',
    			'comments-link'
    		);
    	}
    	return $output;
    }, 10);

    Can you also take a screenshot of your current Archive settings in Customizer > Layout > Blog?

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