• Resolved AZBros

    (@azbros)


    Hi,
    I’m new to the concept of adding page breaks to WordPress (always wanted to do it, just now looked up how to do it). Of course, it’s super easy, so that’s great.

    While testing it on my site, initially I thought the navigation links weren’t displaying at all. I then realized they were way at the bottom of my post. Instead of showing up right where the break occurred (i.e. immediately under the written post content), it showed up after my Author Card and AddToAny sharing icons. I’m guessing the issue is because the Author Card and AddToAny links are from plugins.

    Is there any way to move the Pagination links upward so they appear right beneath the written content (or atleast above the plugins)? Thanks for your time and assistance, I appreciate it!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Is there any way to move the Pagination links upward

    The problem is that the plugins look for the end of the post content and that’s where they position themselves. It doesn’t work to just write a function and try to append the pagination to the content so it appears to be part of the post content; the plugins still see the end of the actual content. Another option (although I haven’t actually tried this) is to rewrite the DOM using jQuery, essentially rearranging the elements on the page after the page is built, but that approach is a bit more complicated.

    You may be able to do this using css or editing template files. Can you provide a link to the site?

    Also as bdbrown mentioned, the issue may be with the plugin targeting a certain area.

    Thread Starter AZBros

    (@azbros)

    Hi Jake,
    My site isn’t currently published, I’m still working on it locally.

    I appreciate the input on this topic from you and bdbrown. I’ll keep researching this issue to see if there might be a solution floating around out there.

    @azbros – In all the posts we’ve worked on I don’t remember if we did any jQuery. If we did, add this to your child theme .js file:

    // move post pagination up under post content
    jQuery( document ).ready( function( $ ) {
       $('.entry-inner .pagination').appendTo( $('.entry-inner>p') )
     });

    Let me know if we haven’t worked with jQuery and I’ll post some additional information.

    Thread Starter AZBros

    (@azbros)

    Hi bdbrown,
    I don’t recall doing any jQuery.

    1. Create a new folder /js in your child theme
    2. Add a new text file named my-scripts.js in the /js folder
    3. Copy the code I posted above into my-scripts.js
    4. Add this function to your child theme functions.php file to load your script:

    // Load my custom scripts file
    add_action( 'wp_enqueue_scripts', 'add_my_scripts' );
    function add_my_scripts() {
        wp_enqueue_script('my-custom-scripts', get_stylesheet_directory_uri() . '/js/my-scripts.js', array('jquery'),'1.0', true);
    }
    Thread Starter AZBros

    (@azbros)

    Okay, I set it all up and tested it. It did move the Pagination navigation above the plugins and below my written post content. Unfortunately, it also added Pagination links below every break in the post (i.e. images, headers, paragraphs, etc).

    Missed that; sorry. Change the jQuery function second selector to this:

    ('.entry-inner>p:last')
    Thread Starter AZBros

    (@azbros)

    No problem.

    Just tested it and, so far, everything looks great. I’ll continue to test it but right now I think this solves the problem. Thank you as always, I really appreciate it!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Move Pagination Nav Directly Under Post Content’ is closed to new replies.