• Hello,

    I would like to customize the pagination of my post when I split them with the <!––nextpage––> tag.

    I have the default 1,2,3,4 next

    I would like : Previous 2/10 Next

    I don’t know what to change in single.php : The concerned lines are

    <?php wp_link_pages(array('before' => '<div class="pagination">', 'after' => '</div>', 'link_before' => '<span class="current"><span class="currenttext">', 'link_after' => '</span></span>', 'next_or_number' => 'next_and_number', 'nextpagelink' => __('Next', 'sociallyviral' ), 'previouspagelink' => __('Previous', 'sociallyviral' ), 'pagelink' => '%','echo' => 1 )); ?>

    Here is a website using a custom post pagination : http://amazetify.com/entertainment/33-perfectly-timed-photos/32/

    Thank you for your help !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    Please create a child theme and add this code to its functions.php file:

    add_action( 'after_setup_theme', 'mts_change_post_pagination' );
    function mts_change_post_pagination() {
        remove_filter( 'wp_link_pages_args', 'mts_wp_link_pages_args' );
        add_filter( 'wp_link_pages_args', 'mts_wp_link_pages_args_new' );
    }
    function mts_wp_link_pages_args_new( $args ) {
        global $page, $numpages, $more, $pagenow;
        $args['next_or_number'] = 'next';
        $args['after'] = '<span class="pagination-count">'."$page / $numpages".'</span></div>';
        return $args;
    }

    Additionally, you may need some custom CSS code if the appearance of the new pagination isn’t right.
    Hope that helps.

    Hi Vilto,

    thx, this code works fine for me.

    2 questions:

    How can i put a VIEW ALL link?

    Is it possible to place images as buttons?

    Thx very much

    Frank

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post pagination single.php’ is closed to new replies.