Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Chester

    (@chester-hepburn)

    I found the solution. Got the code

    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentythirteen' ) ); ?></div>
    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?></div>

    in line no 268 in my functions.php file in twenty thirteen theme which is to be replaced with <?php wp_pagenavi(); ?> according to its documentation. but i had to replace the whole block of code looks like

    <?php if ( get_next_posts_link() ) : ?>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentythirteen' ) ); ?></div>
    			<?php endif; ?>
    
    			<?php if ( get_previous_posts_link() ) : ?>
    			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?></div>
    			<?php endif; ?>

    i just wants to ask is there any problem to replace the whole block? Will this affect any other functions in my site?

    Create a child theme, add a functions.php and add this

    // WP-PageNavi
    function twentythirteen_paging_nav() {
    	global $wp_query;
    
    	// Don't print empty markup if there's only one page.
    	if ( $wp_query->max_num_pages < 2 )
    		return;
    	?>
    	<nav class="navigation paging-navigation" role="navigation">
    		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1>
    		<div class="nav-links">
    
    			<?php wp_pagenavi(); ?>
    
    		</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How To Add PageNavi to Twenty Thirteen to WordPress Theme’ is closed to new replies.