[Resolved] Latest update broke my design

Home Forums Support [Resolved] Latest update broke my design

Home Forums Support Latest update broke my design

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1478886
    madmanweb

    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.

    #1478896
    Tom
    Lead Developer
    Lead Developer

    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' );
        }
    } );
    #1478935
    madmanweb

    That fixed the problem on the single pages [1] but removed the meta info entirely on the home page listing [2]

    [1] https://seenunseen.in/episodes/2020/9/6/episode-189-the-acting-life/

    [2] https://seenunseen.in/

    We should also probably throw in some logic so that it doesn’t appear if there’s no content loop being called as in the home page of https://vivekkaul.com

    #1478938
    Tom
    Lead Developer
    Lead Developer
    #1478993
    madmanweb

    Yes, this seems to have worked.

    Thank you.

    #1478994
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

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