[resolved] Stays on Page 1 (6 posts)

  1. gorillaagent
    Posted 2 years 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">
    				$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 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>
    			<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><!--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!


  2. gorillaagent
    Posted 2 years ago #

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

  3. Lester Chan
    Plugin Author

    Posted 2 years 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
    Posted 2 years 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
    Plugin Author

    Posted 2 years ago #

    Yes that is called a static front page.

  6. gorillaagent
    Posted 2 years 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').

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.