WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
[resolved] Stays on Page 1 (6 posts)

  1. gorillaagent
    Member
    Posted 2 months ago #

    My navigation seems top stay on page 1 (page 1 of 2).

    I followed this thread http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html with no avail.

    Here is my loop, it's on a custom home page.

    <?php $my_query = new WP_Query( array( 'showposts' => 6, 'orderby' => 'post_date', 'order' => 'DESC', 'paged' => get_query_var('paged') ) ); ?>
    <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
    
    <div class="post-wrap col-md-6">
    	<div class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    	<div class="post-meta">By: <?php _e("", "wpbootstrap"); ?> <?php the_author_posts_link(); ?> | <?php _e("Posted", "wpbootstrap"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time(); ?></time></div>
    	<div class="post-inner2">
    		<div class="post-image col-md-5">
    			<?php
    				$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
    				$url = $thumb['0'];
    			?>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?> image"><img src="<?php echo $url ?>" alt="image" /></a>
    		</div>
    		<div class="post-text col-md-7"><small><?php the_excerpt(); ?></small></div>
    		<div class="clearfix"></div>
    		<div class="post-bottom">
    			<div class="post-category col-md-6">
    				<img src="<?php bloginfo('url'); ?>/wp-content/uploads/2014/03/Tags-Flat-icon.png" alt="icon" /> <small>Category: <?php $category = get_the_category(); if($category[0]){
    				echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>'; } ?></span>
    				</small>
    			</div>
    			<div class="col-md-1"></div>
    			<div class="post-comments col-md-5"><small><?php comments_popup_link(__('Leave a comment', 'example'), __('<span class="label label-danger">1</span> Comment', 'example'), __('<span class="label label-danger">%</span> Comments', 'example'), 'comment-btn', __('Comments closed', 'example')); ?> </small></div>
    			<div class="clearfix"></div>
    		</div>
    	</div>
    </div><!--end post-->
        <?php endwhile; ?>
    <div class="pull-right"><?php wp_pagenavi( array( 'query' => $my_query ) ); ?></div>
    <?php wp_reset_query(); ?>

    Any help is much appreciated!

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

  2. gorillaagent
    Member
    Posted 2 months ago #

    http://www.amguild.org/ - This is the site I am working on.

  3. Lester Chan
    Member
    Plugin Author

    Posted 2 months ago #

    if you are on a static front page, you should be using get_query_var('page') not `get_query_var('paged'). You might want to read through http://codex.wordpress.org/Class_Reference/WP_Query and try the examples.

  4. gorillaagent
    Member
    Posted 2 months ago #

    Thanks Lester. Not a static page, in fact I am using the Brew starter theme. My page is a page template inside my theme files called "Home Page" and it is selected via the wordpress settings > reading to be the Home page.

  5. Lester Chan
    Member
    Plugin Author

    Posted 2 months ago #

    Yes that is called a static front page.

  6. gorillaagent
    Member
    Posted 2 months ago #

    Oh I see, static home page with dynamic content gotcha... OK thanks. That did work using get_query_var('page') not `get_query_var('paged').

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.