[Resolved] Prev/Next posts

Home Forums Support [Resolved] Prev/Next posts

Home Forums Support Prev/Next posts

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #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

    #1476381
    David
    Staff
    Customer Support

    Hi there,

    what functions are you using to display the Post meta ?

    #1476475
    manaadiar

    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 minutes

    the issue is that

    1) this is being duplicated
    2) it is also bringing the PREV and NEXT links here

    Both of this happened since the GP Premium update that was done today..

    #1476813
    David
    Staff
    Customer Support

    By default GP doesn’t display all that Meta in that place.
    So you must of added a PHP Snippet to display the meta ?

    #1477241
    manaadiar

    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;
    	}
    }
    #1477279
    Tom
    Lead Developer
    Lead Developer

    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() {
        return array(
            'date',
            'author',
            'categories',
            'tags',
            'comments-link',
            'reading-time',
        );
    } );
    
    add_filter( 'generate_footer_entry_meta_items', function() {
        return array(
            'post-navigation',
        );
    } );
    #1477403
    manaadiar

    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..

    #1477405
    Tom
    Lead Developer
    Lead Developer

    That’s not a great idea – it will likely result in more breakages, especially with future versions.

    What was the exact error?

    #1477408
    manaadiar

    Ooops, can you let me have the latest post-meta.php file info, i can try replacing that and let you know the error..

    #1477416
    Tom
    Lead Developer
    Lead Developer
    #1477424
    manaadiar

    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..

    #1477489
    Tom
    Lead Developer
    Lead Developer
    #1477895
    manaadiar

    Hi Tom the site is now giving error after all these updates..

    There has been a critical error on your website.

    #1478841
    Tom
    Lead Developer
    Lead Developer

    The code itself should be fine. Is there a specific error?

    Is reading_time() a function you’ve added to your functions?

    #1478925
    manaadiar

    Hi, this is sorted now, thanks..

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