- This topic has 15 replies, 3 voices, and was last updated 2 years, 8 months ago by
Tom.
-
AuthorPosts
-
October 7, 2020 at 3:30 am #1476128
manaadiar
Hi, after the latest GP updates, my meta tags are showing as below.. Can you pls assist in moving this to the bottom of the article.. What code must I change in the child theme to do this.. Pls click below link to see the error..
https://www.shippingandfreightresource.com/wp-content/uploads/GPERROR.png
October 7, 2020 at 6:13 am #1476381David
StaffCustomer SupportHi there,
what functions are you using to display the Post meta ?
October 7, 2020 at 7:11 am #1476475manaadiar
Hi David, don’t understand your question..
in the Post meta i have
October 7, 2020 by Hariesh Manaadiar
Categories : Climate Change, News, Press Release
Tags : Bulk, Climate Change, The Sea Cargo Charter
Leave a comment
Estimated reading time = 5 minutesthe issue is that
1) this is being duplicated
2) it is also bringing the PREV and NEXT links hereBoth of this happened since the GP Premium update that was done today..
October 7, 2020 at 8:25 am #1476813David
StaffCustomer SupportBy default GP doesn’t display all that Meta in that place.
So you must of added a PHP Snippet to display the meta ?October 7, 2020 at 12:09 pm #1477241manaadiar
Yes, I had, but that was in my child theme.. See below code.. But something in the parent theme is overriding this and causing it to duplicate..
// Code to move cat/tags/comments to the top of the page – original deleted from post-meta.php
if ( ! function_exists( 'generate_post_meta' ) ) { add_action( 'generate_after_entry_title', 'generate_post_meta' , 'generate_after_entry_content', 'generate_footer_meta' ); /** * Build the post meta. * * @since 1.3.29 */ function generate_post_meta() { if ( 'post' == get_post_type() ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> <?php generate_entry_meta(); ?> Estimated reading time = <?php echo reading_time(); ?> <?php endif; } } // Code to show the next and previous post - original deleted from post-meta.php if ( ! function_exists( 'generate_footer_meta' ) ) { add_action( 'generate_after_entry_content', 'generate_footer_meta' ); /** * Build the footer post meta. * * @since 1.3.30 */ function generate_footer_meta() { if ( 'post' == get_post_type() ) : ?> <footer class="entry-meta"> <?php if ( is_single() ) { generate_content_nav( 'nav-below' ); } ?> </footer><!-- .entry-meta --> <?php endif; } }
October 7, 2020 at 12:29 pm #1477279Tom
Lead DeveloperLead DeveloperInstead of that code, try this:
add_action( 'generate_post_meta_items', function( $item ) { if ( 'reading-time' === $item ) { echo 'Estimated reading time = ' . reading_time(); } } ); add_filter( 'generate_header_entry_meta_items', function() { return array( 'date', 'author', 'categories', 'tags', 'comments-link', 'reading-time', ); } ); add_filter( 'generate_footer_entry_meta_items', function() { return array( 'post-navigation', ); } );
October 7, 2020 at 1:55 pm #1477403manaadiar
Hi Tom, it gave an error – something unexpected ‘ in line 63.. But when I copied the old post-meta.php file info into the new update, it worked fine..
October 7, 2020 at 1:57 pm #1477405Tom
Lead DeveloperLead DeveloperThat’s not a great idea – it will likely result in more breakages, especially with future versions.
What was the exact error?
October 7, 2020 at 2:00 pm #1477408manaadiar
Ooops, can you let me have the latest post-meta.php file info, i can try replacing that and let you know the error..
October 7, 2020 at 2:06 pm #1477416Tom
Lead DeveloperLead DeveloperThis is the 3.0.0 post-meta.php file: https://raw.githubusercontent.com/tomusborne/generatepress/3.0.0/inc/structure/post-meta.php
October 7, 2020 at 2:13 pm #1477424manaadiar
This link (https://www.shippingandfreightresource.com/wp-content/uploads/GPerror-after-update.png) is the error after GP Premium updates..
This link (https://www.shippingandfreightresource.com/wp-content/uploads/GPerror-after-using-code.png) is the error after I use below code given by you
Instead of that code, try this:
add_action( ‘generate_post_meta_items’, function( $item ) {
if ( ‘reading-time’ === $item ) {
echo ‘Estimated reading time = ‘ . reading_time();
}
} );add_filter( ‘generate_header_entry_meta_items’, function() {
‘date’,
‘author’,
‘categories’,
‘tags’,
‘comments-link’,
‘reading-time’,
} );add_filter( ‘generate_header_entry_meta_items’, function() {
return array(
‘post-navigation’,
);
} );Pls advise, thanks..
October 7, 2020 at 3:05 pm #1477489Tom
Lead DeveloperLead DeveloperAha, can you try the updated code?: https://generatepress.com/forums/topic/prev-next-posts/#post-1477279
October 8, 2020 at 12:30 am #1477895manaadiar
Hi Tom the site is now giving error after all these updates..
There has been a critical error on your website.
October 8, 2020 at 9:24 am #1478841Tom
Lead DeveloperLead DeveloperThe code itself should be fine. Is there a specific error?
Is
reading_time()
a function you’ve added to your functions?October 8, 2020 at 10:08 am #1478925manaadiar
Hi, this is sorted now, thanks..
-
AuthorPosts
- You must be logged in to reply to this topic.