Home › Forums › Support › Moving post meta (date updated) below featured image is not working after 3.0?
- This topic has 6 replies, 4 voices, and was last updated 4 years, 1 month ago by
Leo.
-
AuthorPosts
-
October 7, 2020 at 7:18 am #1476489
Roy
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?
ThanksOctober 7, 2020 at 8:43 am #1476867Tom
Lead DeveloperLead DeveloperHi 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 🙂
October 7, 2020 at 12:00 pm #1477212Roy
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!
October 7, 2020 at 12:02 pm #1477220Tom
Lead DeveloperLead DeveloperYou’re welcome!
That’s great to hear! 🙂
March 1, 2022 at 11:41 am #2138468Paul
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?March 1, 2022 at 11:46 am #2138475Paul
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?
March 1, 2022 at 2:40 pm #2138639Leo
StaffCustomer SupportCan you open a new topic for your question?
This one is a bit old already.
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.