WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
[resolved] PageNavi not loading beyond page 1 (3 posts)

  1. INchargeWebsite
    Member
    Posted 4 months ago #

    My wordpress theme is supposed to be compatible with PageNavi but when I installed the plugin and activated it, it doesn't work like it should.

    My blog is new and has 2 pages of posts. When I click page 2, it just loads the home page (page 1) again.

    This is the code located after the posts:

    <?php get_sidebar('main'); ?>
    	<?php if(function_exists('wp_pagenavi')) { ?>
    	<div id="navigation" class="pagination pagination-centered">
    		<?php wp_pagenavi(); ?>
    	</div>
    	<?php } else { ?>
    
    	<div id="navigation">
    		<ul class="pager">
    			<li id="navigation-previous"><?php previous_posts_link(__('&laquo; Previous', 'pinclone')) ?></li>
    			<li id="navigation-next"><?php next_posts_link(__('Next &raquo;', 'pinclone')) ?></li>
    		</ul>
    	</div>
    	<?php } ?>
    
    	<div id="scrolltotop"><a href="#"><i class="icon-chevron-up"></i><br /><?php _e('Top', 'pinclone'); ?></a></div>
    </div>
    
    <div class="modal hide" id="post-lightbox" tabindex="-1" role="dialog" aria-hidden="true"></div>

    The code for the page is:

    <?php get_header(); global $user_ID; ?>
    
    <div class="container-fluid">
    	<?php
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    	function filter_where( $where = '' ) {
    		$duration = '-' . of_get_option('frontpage_popularity_duration') . ' days';
    		$where .= " AND post_date > '" . date('Y-m-d', strtotime($duration)) . "'";
    		return $where;
    	}
    
    	if (is_home()) {
    		if ('likes' == $popularity = of_get_option('frontpage_popularity')) {
    			add_filter('posts_where', 'filter_where');
    
    			$args = array(
    				'meta_key' => '_Likes Count',
    				'meta_compare' => '>',
    				'meta_value' => '0',
    				'orderby' => 'meta_value_num',
    				'order' => 'DESC',
    				'paged' => $paged
    			);
    			query_posts($args);
    		} else if ($popularity == 'repins') {
    			add_filter('posts_where', 'filter_where');
    
    			$args = array(
    				'meta_key' => '_Repin Count',
    				'meta_compare' => '>',
    				'meta_value' => '0',
    				'orderby' => 'meta_value_num',
    				'order' => 'DESC',
    				'paged' => $paged
    			);
    			query_posts($args);
    		} else if ($popularity == 'comments') {
    			add_filter('posts_where', 'filter_where');
    
    			$args = array(
    				'orderby' => 'comment_count',
    				'paged' => $paged
    			);
    			query_posts($args);
    		} else {
    			$args = array(
    				'paged' => $paged
    			);
    			query_posts($args);
    		}
    	}
    
    	get_template_part('index', 'masonry');
    	get_footer();?>

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

  2. Lester Chan
    Member
    Plugin Author

    Posted 4 months ago #

    Checkout http://wordpress.org/support/topic/navigation-not-working-3?replies=1 and if you can't figure it out, contact your theme author because he will be more familiar with his own code than me.

  3. INchargeWebsite
    Member
    Posted 4 months ago #

    Thanks. I'll look that over.

    It appears that the problem is coming from this block of code

    <?php get_header(); ?>
    <div class="container-fluid">
    	<?php
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args = array(
    		'post_type' => 'post',
    		'paged' => $paged
    	);
    
    	query_posts($args);
    
    	get_template_part('index', 'masonry');
    	get_footer();?>

Reply

You must log in to post.

About this Plugin

About this Topic