• Resolved twirth5

    (@twirth5)


    The PageNavi and default page navigation appears in posts below Jetpack “Share this:,” “Like this:” and “Related,” and above “Previous/Next Story.”

    I am concerned that some readers may not scroll down far enough to see the page controls and assume that they have reached the end of a multipage post.

    How do I move the page controls up?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi twirth5. Can you post a link to an example on your site? Thanks.

    Thread Starter twirth5

    (@twirth5)

    As usual, thank you for your rapid response!

    https://wp.me/p76U8a-8LJ

    I don’t use Jetpack so don’t have your exact environment. Turned out to be a bit more involved than I anticipated but I did some testing and this seemed to work to reposition the pagenavi controls:

    1. Remove these two lines in your child theme single.php file:

    <?php the_content(); ?>
    <?php wp_pagenavi( array( 'type' => 'multipart' ) ); ?>

    2. Insert the following block of code in the same place in single.php:

    <?php	//move the PageNavi controls above the Jetpack elements below the post content
    	//assign pagenavi code to variable
    	$pagenavi = "<?php wp_pagenavi( array( 'type' => 'multipart' ) ) ?>";
    	//get the post content
    	$content = get_the_content();
    	$content = apply_filters('the_content', $content);
    	//append pagenavi code to post content
    	$content = $content . $pagenavi;
    	//start the output buffer
    	ob_start();
    	//parse the pagenavi php code appended to the content
    	eval("?".">".$content);
    	//assign the buffer content to the content variable
    	$content = ob_get_contents();
    	//clear the output buffer
    	ob_end_clean();
    	//output the content to the page
    	echo $content . '<br>';
    ?>

    3. The bottom border under the pagenavi page numbers is normally hidden by the content overflow setting. If you want to hide it in the new location you can try adding this to your custom css:

    .wp-pagenavi {
        overflow: hidden !important;
    }

    Hope that helps.

    Thread Starter twirth5

    (@twirth5)

    That is impressive! Thank you for your hard work.

    Unfortunately, the new code didn’t accomplish anything.

    Fortunately, the page looked exactly the same so there no collateral damage–but I restored single.php anyway.

    Maybe I need to poke around in the Jetpack forums?

    The idea was to add the pagenavi elements to the post content so Jetpack would load below that. Conceptually it worked when I tested it on a site with a couple of widgets, but not with Jetpack installed. So it would seem that, on your site, either the mod didn’t take affect or Jetpack has some way of carving out that extra content. If you want me to take a look at it let me know when you get the mod installed again. If you’d rather not pursue that option then yes, you might check with Jetpack support to see if they have any ideas. If they have a solution it might be helpful to other users if you could post it here.

    Thread Starter twirth5

    (@twirth5)

    Thanks again.

    Instead of messing around with Jetpack and code, I decided to deactivate the Jetpack features that are also built into the hueman theme and try those instead (like “related posts”).

    Now the bottom of the page is now much cleaner and the pagenavi controls are much closer to the bottom of the post.

    It appears that overlapping Jetpack/hueman features compete for screen space. It is also apparent that hueman was created with pagenavi in mind.

    Case closed.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Move page navigation up in multipage posts’ is closed to new replies.