Site logo

Archived topic

Moving post meta (date updated) below featured image is not working after 3.0?

6 replies · Started by Roy on October 7, 2020

Viewing posts 1–7 of 7

I always moved the meta (date last updated on) to Below the featured image using this recommended code in child Functions:

add_action( 'after_setup_theme', function() {
remove_action( 'generate_after_entry_title', 'generate_post_meta' );
add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
} );

But since updating to 3.0 this shows 2 dates - 1 above and 1 below the featured image
i.e. the add_action works fine but the remove_action no longer removes the meta from above the featured image...

Happens using flexbox or floats. Any ideas - does the generate_after_entry_title need changing to something new?
Thanks

Hi there,

Try this instead:

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

Let me know :)

Hi Tom, you're a star - changing it to 'wp' worked perfectly :-)

Thanks for the very quick help.

Ps my scores on Page Speed and GTmetrix have both gone up since the new version and switching to Flexbox - nice work!

You're welcome!

That's great to hear! :)

The following code does not work properly....
add_action( 'wp', function() {
remove_action( 'generate_after_entry_title', 'generate_post_meta' );
add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
} );

It adds the meta on every single page in .inside-article .entry-meta, which is not what people want.
We simply want to modify the blog page and not every page on our site.
in saying this, how do I target just the blog page's code and not break every other page?

Since I don't want to run the following PHP code via snippets and break every page of my site, is there better code to use then this so that it only applies to html classes or ids on my blog page?
add_action( ‘wp’, function() {
remove_action( ‘generate_after_entry_title’, ‘generate_post_meta’ );
add_action( ‘generate_after_entry_header’, ‘generate_post_meta’, 15 );
} );

Also, can I use a hook to apply this code just to blog pages instead of everything like code snippets does?

Can you open a new topic for your question?

This one is a bit old already.

Thanks!

This archived topic is closed to new replies.