• Resolved heath18

    (@heath18)


    Can you point me in the direction of how to add previous/next post buttons at the bottom of each individual post? Last time I tried to do this I messed up or had the wrong PHP code and it broke my site.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Leo

    (@leohsiang)

    Hi there,

    Are you referring to the post navigation at the bottom of this sample post here?
    https://gpsites.co/marketer/2018/09/08/top-10-contact-form-plugins/

    That should show by default in the free theme.

    Are you using GP Premium or any custom function to turn that off?

    Thread Starter heath18

    (@heath18)

    I’m not using any functions to turn it off that im aware of. I am not using GP premium currently. I am using some PHP to remove the categories from the home page. Maybe that is removing those?

    Leo

    (@leohsiang)

    I am using some PHP to remove the categories from the home page. Maybe that is removing those?

    I don’t think that’s the reason but can you disable that function to test anyways?

    Please try to disable all of your custom functions to test first and activate the parent theme if you are using a child theme.

    Let me know ??

    Thread Starter heath18

    (@heath18)

    Oh I am using the newer theme though. Does that make a difference? No child theme is being used.

    Leo

    (@leohsiang)

    Newer theme as in 3.0 Alpha?

    It shouldn’t make a difference.

    Any chance you can disable all plugins and custom functions to eliminate any conflicts?

    If that doesn’t work, can you delete and reinstall the theme to make sure no files were corrupted?

    Let me know ??

    Thread Starter heath18

    (@heath18)

    Yes….thats the one. I deactivated the code snippets I have and that makes the previous and next post appear now. But it also shows the category folder and I dont want that.

    Leo

    (@leohsiang)

    I’m actually not seeing the category folder.

    Are you talking about tags?

    If so try this CSS:

    .tag-links {
        display: none;
    }
    Thread Starter heath18

    (@heath18)

    So this is probably beyond the scope of the free theme but putting that CSS in, it still doesn’t show it. I had to reactivate the PHP because it shows the author avatar at the beginning right under the title.

    So I dont know what to change to bring back the previous/next function.

    Leo

    (@leohsiang)

    Was this what you were after?
    https://docs.generatepress.com/article/entry-meta-style/#example-1

    If so can you make sure to use that PHP and CSS only?

    It shouldn’t remove the post navigation.

    Thread Starter heath18

    (@heath18)

    I believe that’s what i had and I’ve got the same issue. Still not showing the next post. Also the read more isn’t boxed but that is the look I was going for.

    Leo

    (@leohsiang)

    Ok we were able to identify the issue – it’s a bug introduced in 3.0.

    Can you edit the PHP snippet to this for now?

    add_filter( 'generate_post_author_output', function() {
        return sprintf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
                esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
                esc_html( get_the_author() ),
                get_avatar( get_the_author_meta( 'ID' ) )
            )
        );
    } );
    
    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'comments-link',
            'date',
        );
    } );
    
    add_filter( 'generate_footer_entry_meta_items', function( $items ) {
        return array(
            'categories',
    	'post-navigation',
        );
    } );

    The CSS should remain the same.

    Thread Starter heath18

    (@heath18)

    I updated it to that and my site got an error again using the Code Snippets plugin.

    Leo

    (@leohsiang)

    It shouldn’t be. I tested the code before posting and it worked:
    https://www.screencast.com/t/SpykHpghQhH

    Can you make sure you copy and paste everything correctly?

    Thread Starter heath18

    (@heath18)

    Yep….I must’ve copied it wrong. I have it updated now. I have purchased the premium as well due to all of the awesome support you guys provide.

    Leo

    (@leohsiang)

    Awesome!

    Thanks for your support and discovering the bug ??

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘add previous and next post buttons at the bottom of posts.’ is closed to new replies.