Site logo

Archived topic

Latest update broke my design

5 replies · Started by madmanweb on October 8, 2020

Viewing posts 1–6 of 6

I had set up a snippet on my sites to move the meta info above the title. This was provided by you guys in a previous support ticket:

add_action( 'after_setup_theme','tu_gp_move_meta' );
function tu_gp_move_meta() {
    remove_action( 'generate_after_entry_title', 'generate_post_meta' );
    add_action( 'generate_before_content', 'generate_post_meta' );
}

But this is breaking with the latest update of GP. Now the date is appearing both below AND above the title. Example:
https://seenunseen.in/episodes/2020/9/27/episode-192-the-loneliness-of-the-long-distance-trucker/

Worse, it's appearing on the home page of one of my sites which is a static page designed in Gutenberg with zero posts showing. See: https://vivekkaul.com/

I've hidden the display of "11 August, 2020" with CSS for now but if you check the page source, you will find:

<article id="post-6591" class="post-6591 page type-page status-publish" itemtype="https://schema.org/CreativeWork" itemscope>
<div class="inside-article">
<div class="entry-meta">
<span class="posted-on"><time class="updated" datetime="2020-10-08T20:52:05+05:30" itemprop="dateModified">8 October, 2020</time><time class="entry-date published" datetime="2020-08-11T11:33:52+05:30" itemprop="datePublished">11 August, 2020</time></span> </div>

These issues go away if I disable the snippet, but then I _want the date above the title.

Please tell me how to fix this.

Hi there,

Try this instead:

add_action( 'wp', function() {
    remove_action( 'generate_after_entry_title', 'generate_post_meta' );

    if ( 'post' === get_post_type() ) {
        add_action( 'generate_before_content', 'generate_post_meta' );
    }
} );

Yes, this seems to have worked.

Thank you.

You're welcome :)

This archived topic is closed to new replies.