[Resolved] Entry Meta Style

Home Forums Support [Resolved] Entry Meta Style

Home Forums Support Entry Meta Style

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #962406
    Ronja

    Ok, so the php is:

    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" 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' ) )
            )
        );
    } );
    
    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',
        );
    } );
    
    add_action( 'after_setup_theme', function() { 
        remove_action( 'generate_after_entry_title', 'generate_post_meta' );
        add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
    } );

    The CSS:

    .byline img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    position: relative;
    vertical-align: middle;
    margin: 0 10px 0 0;
    }
    .comments-link
    .posted-on {
    border-left: 1px solid #ddd;
    padding-left: 10px;
    margin-left: 10px;
    }
    .post-image + .entry-meta > * {
        display: inline-block;
    }
    
    .posted-on .updated {
    display: inline-block;
    }
    .posted-on .updated + .entry-date {
    display: none;
    }
    
    .posted-on .updated:before {
    content: "Zuletzt aktualisiert: ";
    }
    #962602
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this as your PHP:

    add_filter( 'generate_post_author_output', function() {
        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 ( ! 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>';
        }
    } );
    
    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'date',
        );
    } );
    
    add_filter( 'generate_footer_entry_meta_items', function( $items ) {
        return array(
            'date',
            'categories',
            'post-navigation',
        );
    } );
    
    add_action( 'after_setup_theme', function() { 
        remove_action( 'generate_after_entry_title', 'generate_post_meta' );
        add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
    } );

    Let me know πŸ™‚

    #963171
    Ronja

    Hi Tom,

    I tried to add this php, as soon as I click the “save” button a error page opens saying “page not found”

    #963489
    Tom
    Lead Developer
    Lead Developer

    How are you adding it? Code Snippets?

    #963640
    Ronja

    Yes, I’m using the code snippets plugin

    #963687
    Tom
    Lead Developer
    Lead Developer

    Not sure why it would go to a not found page. Does it work if you save the old code?

    #966558
    Ronja

    Hi Tom,

    It does save the old code.
    I think I’ll just leave it for the time being and maybe try it again as soon as I have more coding skills.
    Thank you so much for your patience with me, you’re doing a great job! πŸ™‚
    Cheers, Ronja

    #967115
    Tom
    Lead Developer
    Lead Developer

    Very strange, I just tried the code and it all worked as it should. If you give it another shot, be sure to copy the entire block of code.

    Thank you! πŸ™‚

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.