WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Remove pagenavi from the top of the page (3 posts)

  1. WPuser3
    Member
    Posted 2 years ago #

    How can I leave pagenavi only in the bottom of the page in Twenty-eleven theme?

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. WPuser3
    Member
    Posted 2 years ago #

    bump

  3. lajaro
    Member
    Posted 2 years ago #

    Had the same problem . Might not be the best way, but I solved it by adding another if statement to functions.php to check if it's the bottom nav. If not, it doesn't do anything.

    Original functions.php (pre PageNavi edits):

    if ( $wp_query->max_num_pages > 1 ) : ?>
                    <nav id="<?php echo $nav_id; ?>">
                            <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
                            <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyeleven' ) ); ?></div>
                            <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></div>
                    </nav><!-- #nav-above -->
            <?php endif;

    With PageNavi changes and code to not output top navi panel:

    if ( $wp_query->max_num_pages > 1 ) : ?>
                    <nav id="<?php echo $nav_id; ?>">
                    <strong><?php if ($nav_id == "nav-below"):?></strong>
                            <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
                            <!-- <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyeleven' ) ); ?></div>
                            <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></div> -->
                            <strong><?php wp_pagenavi(); ?></strong>
                    <strong><?php endif; ?></strong>
                    </nav><!-- #nav-above -->
            <?php endif;

    [Please post code or markup snippets between backticks or use the code button.]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic