[Resolved] Entry Meta Above and Below Title

Home Forums Support [Resolved] Entry Meta Above and Below Title

Home Forums Support Entry Meta Above and Below Title

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #984523
    Merri Dennis

    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.

    #984989
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #985143
    Merri Dennis

    Thanks so much! Worked like a charm.

    #985252
    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.