WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
[resolved] Navigation wont work pages. (2 posts)

  1. cloudstr210
    Member
    Posted 8 months ago #

    Hello,

    First thanks for reading this question.

    I tried to create a custom page template to show archive on one category that I want to show.

    But when I try to go to the second page, the url will change to /page/2 but the content remains the same.

    This is the page (not archive/category page) that I created to show all the post under category 14.

    I wanted to show all of the post of this category:
    http://inspirehaven.com/category/motivational-quote/

    To show it in this page:

    http://inspirehaven.com/motivational-quotes/

    But when I click on the page 2 of this page. It will show the content of page 1.

    These are my codes:

    <?php /* Template Name: Motivational Quotes */ ?>
    <?php get_header(); ?>
    
    		<section id="primary" class="site-content">
    			<div id="content" role="main">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php rewind_posts(); ?>
    
    	<header class="entry-header">
    		<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', '_s' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    
    	</div><!-- .entry-content -->
    <br />
    
    				<?php /* Start the Loop */ ?>
    				<?php query_posts('cat=14'); ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    						/* Include the Post-Format-specific template for the content.
    						 * If you want to overload this in a child theme then include a file
    						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    						 */
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
    				<?php getpagenavi(); ?>
    
    				<?php else : ?>
    
    				<?php get_template_part( 'no-results', 'archive' ); ?>
    
    			<?php endif; ?>
    
    			</div><!-- #content -->
    		</section><!-- #primary .site-content -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

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

  2. gordon34
    Member
    Posted 5 months ago #

    Hi cloudstr210,
    i don't know if you dealt with your problem already but if not, you may have read this article: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html

    Cheers,
    Kamil

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.