Site logo

Archived topic

Post's header design

7 replies · Started by Pheonix on January 1, 2021

Viewing posts 1–8 of 8

Hi there,

Can you link us to your site in question so I can see your current set up?

Thanks :)

Sure thing!

Hi there,

is it just the alignment and the Meta Order that you want to change?

The title is good. I'd like to change the meta. So it'd look like this:

written by AUTHOR | CATEGORY
DATE

Would that be for archives and single posts?

Single posts

Hi Pheonix,

- Use this PHP snippet to change the "by" to " Written by".

add_filter( 'generate_inside_post_meta_item_output', function( $output, $item ) {
    if ( 'author' === $item ) {
        return ' Written by ';
    }
        return $output;
}, 50, 2);

- Use this PHP snippet to move category up from the bottom of a single post.

add_filter( 'generate_post_author_output', function( $output ) {
    echo $output;

    $categories_list = get_the_category_list( ', ' );
    if ( $categories_list ) {
        echo '<span class="cat-links">' .  $categories_list . '</span>';
    }

} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

- Use this CSS to reposition the entry meta.

.single-post .entry-meta .cat-links {
    margin-left: 10px;
}

.single-post .entry-meta {
    display: flex;
    flex-wrap: wrap;
    width: 40%;
}

.single-post .entry-meta .span.posted-on {
    order: 3;
}

Adding CSS: https://docs.generatepress.com/article/adding-css/

Let me know :)

This archived topic is closed to new replies.