[Resolved] Author Avatar and Post Date

Home Forums Support Author Avatar and Post Date

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1340024
    Sam

    I want to left align author avatar and add author post and author date to the right. See attached url’s. I want to make it look like the second url.

    Code I added so far:

    /** Author avatar and post date*/
    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">%1$s %5$s<span class="author-name" itemprop="name">%4$s</span></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_filter( 'generate_post_date_output','tu_remove_date_link', 10, 2 );
    function tu_remove_date_link( $output, $time_string ) {
    	printf( '<span class="posted-on">%s</span>',
    		$time_string
    	);
    }
    .author.vcard img {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        position: relative;
        vertical-align: middle;
        margin: 0 10px 0 0;
    }
    #1340103
    David
    Staff
    Customer Support
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.