• Resolved wizard0412

    (@wizard0412)


    I am trying to add the pagenavi wight after the content from functions.php becouse I have subscription box plugin that is showing after the content and my pagnation is under that.

    I did fix that for the normal pagination with this code:

    function custom_pagination( $content ) {
    if( is_singular() ) {
    $content .= wp_link_pages(‘echo=0’);
    }
    return $content;
    }
    add_filter( ‘the_content’,’custom_pagination’, 1 );

    but when i use the same code and replace wp_link_pages(‘echo=0’ with wp_pagenavi( array( ‘type’ => ‘multipart’ ) );
    the pagnation is shown in beginning of the post/article.

    What to do so my wp_pagenavi will show after the content?

    https://wordpress.org/plugins/wp-pagenavi/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Lester Chan

    (@gamerz)

    You need to add echo false so that it will return and not print.

    function custom_pagination( $content ) {
    if( is_singular() ) {
        $content .= wp_pagenavi( array( 'type' => 'multipart', 'echo' => false ) );
    }
    return $content;
    }
    add_filter( 'the_content','custom_pagination', 1 );

    Thread Starter wizard0412

    (@wizard0412)

    Thank you very much, you saved my ass!

    Hi Lester. This is exactly what I’m looking to do BUT… Did something happen in the new update that you just posted to cause this not to work? I’ve installed this code in my functions.php and it isn’t displaying anything. Could it have something to do with the fact that the “post_type” is “recipe”?

    Here’s my site… http://cookierecipes.com/recipe/chocolate-chocolate-chip-cookies-iii/

    Hi Lester,

    First of all thanks for your great effort. I really appreciate it.

    I have a question with this topic. I paste the code you mentioned to the functions.php but then my functions.php file gave error.

    I want to put pagenavi just after the content and before share button. Which code should i post and to where ?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem adding wp-pagenavi after the content’ is closed to new replies.