I am trying to add pagination in between post and comments.

I used plugin Automatically Paginate Posts for that in which i can able to add pagination after comments and facebook plugin.

  1. Is it possible to add pagination just after post?

i tried to add below code.

<div class="entry-content">
        <?php the_content(); ?>
                    wp_link_pages( array(
                            'before' => '<div class="page-links">' . __( 'Pages:', 'trident' ),
                            'after'  => '</div>',
                    ) );
    </div><!-- .entry-content -->

But still pagination comes after comments.

I tried also in function.php file

function the_content( $more_link_text = null, $strip_teaser = false) {
    $content = get_the_content( $more_link_text, $strip_teaser );

     * Filter the post content.
     * @since 0.71
     * @param string $content Content of the current post.
    $content = apply_filters( 'the_content', $content );
    $content = str_replace( ']]>', ']]&gt;', $content );
    echo $content;

2 Answers 2


I got my solution.

<?php // move pagination links above other end-of-post content additions, like related posts etc.
function move_pagination( $content ) {
    if ( is_single() ) {
        $pagination = wp_link_pages( array(
                    'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'firmness' ) . '</span>',
                    'after'       => '</div>',
                    'link_before' => '<span>',
                    'link_after'  => '</span>',
                    'echo'        => 0,
                ) );
        $content .= $pagination;
        return $content;
    return $content;

add_filter( 'the_content', 'move_pagination', 1 );

I wrote a new function for this purpose. This belongs in functions.php in my child theme, because it affects the layout of my site, and will not be required any more once my change themes.


Depending on your theme, you may look into the template where your comments output reside and include calling pagination before it. For example in TwentyEleven comments output is governed by comments.php

  • i want to add pagination in between post and comment. i tried to add pagination code above the comments.php file code Nov 15, 2014 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.