Site logo

Archived topic

Entry Meta Above and Below Title

3 replies · Started by Merri Dennis on August 14, 2019

Viewing posts 1–4 of 4

I need to split the post meta data to display the date (with day) above the post title and the author name below the title. I am trying to match the post display format on this website https://jeannieburlowski.com/.

The development site is http://jeannie.merridennis.com

Thanks for your assistance.

Hi there,

We can add the date above the entry title like this:

add_action( 'generate_before_entry_title', function() {
    $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';

    $time_string = sprintf( $time_string,
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date( 'l, F j, Y' ) )
    );
    ?>
    <div class="entry-meta custom-post-type">
        <?php echo $time_string; ?>
    </div>
    <?php
} );

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

Then you can disable the standard date in Customize > Layout > Blog.

Let me know if you need more info :)

Thanks so much! Worked like a charm.

You're welcome :)

This archived topic is closed to new replies.