• Resolved jaimecapra

    (@jaimecapra)


    I’m hoping you can help with what should be an easy question. Despite spending much of the night trying to figure this out, I haven’t been able to. I also couldn’t find any code examples, as simple as it may be.

    I have four posts on my site (https://gunsafereviewsguy.com/) that are over 10,000 words. Too long for page speed and other reasons. I’ve paginated them using the <!--nextpage--> shortcode.

    The <!--nextpage--> tag splits the page, adding a set of post pagination links at the bottom of the post. Using add_filter('wp_link_pages_args','xxxx'); in my
    genesis child theme’s functions.php, I added <div>‘s and classes and applied the CSS formatting. Good so far.

    The last step was that I want to add another matching pagination
    link bar to the top of the post, to match the one on the bottom. All of
    the documentation on pagination links I found involves either:

    • archive (not post) pagination,
    • next/previous links to different posts (not the same post),
    • or CSS styling of pagination links.

    None of them discuss how to add another set of links to single posts pagenated using the <!--nextpage--> shortcode.

    I was able to echo some text above the post using functions.php, but I couldn’t get another links bar there. I also tried to make a custom post template with an additional top links bar with no success.

    The bottom of my paginated single page posts (example) already have paginated link bars. Does anyone know how I can put a matching set of pagination links at the top?

Viewing 1 replies (of 1 total)
  • Thread Starter jaimecapra

    (@jaimecapra)

    I figured it out.

    I created a new single-post.php template for my Genesis child theme.

    The template includes this code to add pagination links above the content for every page except the first one (0), and below the content for all pages. Setting the $priority argument to 2 puts the links before the content, and 11 puts them after.

    if ($page != 0){
    	/* don't add links to the first page */
    	add_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 2 );
    	add_action( 'genesis_post_content', 'genesis_do_post_content_nav', 2 );
    }
    
    add_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 11 );
    add_action( 'genesis_post_content', 'genesis_do_post_content_nav', 11 );
Viewing 1 replies (of 1 total)
  • The topic ‘Want to Add Top of Post Single Post Pagination Links’ is closed to new replies.