[Resolved] Single post meta customization

Home Forums Support Single post meta customization

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1516996
    George

    I want to display my post meta like the example attached.

    Like Example 2 from this article but add the category in the form of: [POST AUTHOR] in [CATEGORY] (or multiple categories separated by commas).

    #1517819
    George

    I know I have only posted that yesterday and I am sorry to be asking that but it’s quite critical and I need to finish it today. Is it possible?

    Thank you!

    #1518033
    Tom
    Lead Developer
    Lead Developer

    It may be worth completely stopping GP from outputing the standard meta, and adding it yourself:

    add_filter( 'generate_header_entry_meta_items', '__return_empty_array' );
    
    add_action( 'generate_after_entry_title', function() {
        ?>
            <div class="entry-meta entry-meta-container">
                <div class="entry-meta-gravatar">
                    <?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
                </div>
    
                <div class="entry-meta-info">
                    <div class="entry-meta-author">
                        <?php generate_do_post_meta_item( 'author' ); ?> in <?php generate_do_post_meta_item( 'categories' ); ?>
                    </div>
    
                    <div class="entry-meta-date">
                        <?php generate_do_post_meta_item( 'date' ); ?>
                    </div>
                </div>
            </div>
        <?php
    } );

    Then your CSS:

    .entry-meta-container {
        display: flex;
        align-items: center;
    }
    
    .entry-meta-gravatar {
        margin-right: 10px;
    }
    
    .entry-meta-gravatar img {
        width: 50px;
    }
    
    .entry-meta-info {
        display: block;
    }
    #1518049
    George

    Hi Tom, thanks for getting back.

    Ok, it almost works, I can add border-radius to the image. I would like to remove the “by” before the author’s name and add “Last updated: ” after the date.

    I would imagine, I would use the :before pseudo element for the “Last updated: ” text.

    #1518216
    George

    Hi, Tom. I used the code found on this post to remove the by from author.

    All good now, thank you!

    #1518237
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.