[Resolved] Entry meta one below the other

Home Forums Support [Resolved] Entry meta one below the other

Home Forums Support Entry meta one below the other

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #713218
    Diogenes

    Hi.

    I have my entry meta with the image of the author with this code:

    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<a href="%2$s" title="%3$s" rel="author"><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' ) )
    		)
    	);
    }

    But the metadata is in a single line horizontally.

    Is it possible to achieve that the meta of the author and the date are one below the other, with the image of the author of the post on the left, as shown in the following image?

    [img]http://img.fenixzone.net/i/eSR5MNY.png[/img]

    Thanks for the help.

    #713825
    Tom
    Lead Developer
    Lead Developer

    Tough one!

    Let’s try this as your function:

    add_filter( 'generate_post_author', '__return_false' );
    add_filter( 'generate_post_date_output', function( $date ) {
        printf( 
            '<span class="meta-gravatar">%s</span>',
            get_avatar( get_the_author_meta( 'ID' ) )
        );
    
        echo '<span class="meta-data">';
    
        printf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s<a href="%2$s" title="%3$s" rel="author"><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() )
            )
        );
    
        echo $date;
    
        echo '</span>';
    } );

    Then let me know and I’ll be able to finish it up with some CSS ๐Ÿ™‚

    #714731
    Diogenes

    It works perfect.

    I made some adjustments and it works great.

    Thanks for the help.

    #714977
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

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