[Support request] Post Meta Customization Error

Home Forums Support Post Meta Customization Error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1278280
    Atul

    Hi i have followed your code explained in this link (https://generatepress.com/forums/topic/how-could-i-customize-blog-content-layout-like-the-example-below/)

    Its working fine on Home Archive Post but not working properly with single post

    //used css

    .byline img {
        display: inline-block;
        vertical-align:  middle;
        width: 20px;
        border-radius:  50%;
        margin-right: 10px;
    }
    
    .entry-header .comments-link {
        display: inline-block;
        margin: 0 10px;
        padding: 0 10px;
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
    }
    
    .posted-on .updated {
        display: inline-block;
    }
    
    .posted-on .updated + .entry-date {
        display: none;
    }
    
    .posted-on .updated:before {
        content: "Last Updated ";
    }

    //Php

    add_filter( 'generate_show_comments', '__return_false' );
    add_filter( 'generate_show_author', '__return_false' );
    add_filter( 'generate_post_date_output', 'tu_custom_post_meta' );
    function tu_custom_post_meta( $output ) {
    	printf( ' <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' ) )
    		)
    	);
    
        if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
            echo '<span class="comments-link">';
                comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
            echo '</span>';
        }
    
    	echo $output;
    }

    Please check single post here: https://kumaratul.com/social-media-image-sizes-2020/

    #1278350
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try removing this part of the code:

    ! is_single() &&

    Let me know 🙂

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