• hi guys,

    i’m currently trying to resolve a pagination issue on a website i’m currently working on. i managed to make the “wp-pagenavi” work on posts.

    link: https://lgrathletics.com/lgr/category/basketball/page/2

    <?php get_header();?>
    
    <?php get_sidebar();?>
    
    <div class="main-contents">this is the archive
    <div id="gridContainer">
    
    <div class="category_title"><h2><?php single_cat_title(); ?> </h2></div>
    
    <?php
    $c = 1; //init counter
    $bpr = 3; //boxes per row
    
    if(have_posts()) :
    	while(have_posts()) :
    		the_post();
    ?>
    			<div class="post <?php
    global $wp_query;
    $postid = $wp_query->post->ID;
    
    echo get_post_meta($postid, 'third_post', true);
    wp_reset_query();
    ?>" id="post-<?php the_ID(); ?>">
    				<h1 class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    				<div class="postImage">
    					<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('grid-post-image'); ?></a>
    				</div>
    				<div class="postExcerpt">
    					<?php the_excerpt(); ?>
    				</div>
    			</div>
    <?php
    if($c == $bpr) :
    ?>
    <div class="clr"></div>
    <?php
    $c = 0;
    endif;
    ?>
    <?php
            $c++;
    	endwhile;
    endif;
    ?>
    <?php wp_pagenavi(); ?>
    <div class="clr"></div>
    </div>
    </div>
    
    <?php get_footer(); ?>

    now i’m trying to make the same layout and function on pages. is this actually possible??? the pagination is not appearing.

    link: https://lgrathletics.com/lgr/basketball

    <?php
    /*
    Template Name: Product Grid
    */
    ?>
    
    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div class="main-contents">this is the product grid
    <div id="gridContainer">
    
    <div class="category_title"><h2><?php
    $parent_title = get_the_title($post->post_parent);
    echo $parent_title;
    ?>
     </h2></div>
    
    <?php if ( (is_page('Products')) or (is_page('Basketball')) ) {
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;	
    
    query_posts(array('showposts' => 3, 'post_parent' => 173, 'post_type' => 'page'));
    
    	while (have_posts()) {
    
    		the_post(); // vital
    
    		$thumbPath = get_post_meta($post->ID, 'thumbnail', true);
    
    		if ($thumbPath == "") {
    			$thumbPath = "/images/comingsoon.png";
    
    		}
    
    		?>
            <div class="post <?php echo get_post_meta($post->ID, 'third_post', true); ?>">
    
            <h1 class="title"><a href="<?php the_permalink() ?>" class="grid-product">
            <?php the_title(); ?></a></h1>
            <div class="postImage">
            	<a href="<?php the_permalink() ?>" class="grid-product"><img src="<?php echo $thumbPath ?>" alt="" /></a>
            </div>
            <div class="postExcerpt">
    					$<?php echo get_post_meta($post->ID, 'price', true); ?>
    				</div>
    
            </div>
    
        <?php }
    
    	wp_reset_query(); // Restore global post data
    
    }
    ?>
    
    <?php if(function_exists('wp_pagenavi')) { // if PageNavi is activated ?>
    
    <?php wp_pagenavi(); // Use PageNavi ?>
    
    <?php } else { // Otherwise, use traditional Navigation ?>
    
    <div class="nav-previous">
    <!-- next_post_link -->
    </div>
    
    <div class="nav-next">
    <!-- previous_post_link -->
    </div>
    
    <?php } // End if-else statement ?>
    
    <div class="clr"></div>
    </div>
    </div>
    
    <?php get_footer(); ?>

    hoping for you help on this. thanks in advance. ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP-PageNavi] Pagination for pages (Possible?)’ is closed to new replies.