WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Small issue with pagination (2 posts)

  1. hbalagh
    Member
    Posted 3 years ago #

    I have the following code (altering a template i got) on my index page, which I have set to exclude a category from showing, however when i hit the next page link it shows me the same exact 5 post that were on the first page (only shows the last 5 post no matter how far back or forward i go

    <?php if(is_search()):?><div class="copy"><h3 class="pagetitle"><?php _e('Search Results', TDOMAIN);?></h3></div><?php endif;?>
    
    <?php if(is_single()){include(TEMPLATEPATH.'/_postnav.php');}?>
    
    <!-- the Loop -->
    
    		<?php query_posts("cat=-54"); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<div class="postwrap">
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<div class="copy fix">
    				<div class="post-title">
    					<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    				</div>
    				<!--/post-title -->
    				<div class="post-date"><em><?php _e('On', TDOMAIN);?> <?php the_time(get_option('date_format')); ?>, <?php _e('In',TDOMAIN);?> <?php the_category(', ', TDOMAIN) ?>, <?php _e('By', TDOMAIN);?> <?php the_author(); ?></em></div>
    				<?php if(is_single() && pagelines('excerptshidesingle')):?>
    				<?php else: ?>
    				 	<?php if(!pagelines('excerptshide') && VPRO):?><div class="post-excerpt"><?php the_excerpt(); ?></div><?php endif;?>
    				<?php endif; ?>
    
    			</div>
    			<?php  if(is_single() || !pagelines('excerpts') || !VPRO):?>
    				<div class="copy">
    					<div class="post-content">
    						<?php if(function_exists('the_post_thumbnail') && has_post_thumbnail()): ?>
    			            		<div class="postthumb">
    									<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link To', TDOMAIN);?> <?php the_title_attribute();?>">
    										<?php the_post_thumbnail('thumbnail');?>
    									</a>
    					            </div>
    						<?php endif; ?>
    						<?php the_content(); ?>
    						<?php  if(is_single()) link_pages('<p><strong>Pages: </strong> ', '</p>', 'number'); ?>
    						<?php edit_post_link('Edit Post', '', '');?>
    					</div>
    					<div class="tags">
    					<?php __(the_tags('Tagged with: ',' &bull; ','<br />'),TDOMAIN); ?>&nbsp;
    					</div>
    
    				</div>
    				<?php if(pagelines('authorinfo') && VPRO):?>
    					<?php include(TEMPLATEPATH.'/_authorinfo.php');?>
    				<?php endif;?>
    
    			<?php endif;?>
    				<div class="post-footer pfooterlight">
    
    						<div class="left">
    							<span><?php comments_number(0, 1, '%'); ?></span>
    							<a href="<?php the_permalink(); ?>#comments" title="<?php _e('View Comments');?>"><?php _e('Comments');?></a>
    						</div>
    						<div class="right">
    							<?php edit_post_link('Edit Post', '', ' | ');?><span><a href="<?php the_permalink(); ?>#respond" title="<?php _e('Leave A Response');?>"><?php _e('Leave A Response');?></a></span></div>
    
    					<div class="clear"></div>
    
    				</div>
    				<div class="hl"></div>
    		</div><!--post -->
    	</div>
    
    	<!-- comments -->
    		<?php if(is_single()):?>
    			<?php include(TEMPLATEPATH.'/_commentsform.php');?>
    	<!-- /comments-->
    
    		<?php endif; endwhile; ?>
    
    	<?php include(TEMPLATEPATH.'/_pagination.php');?>
    
    <?php else : ?>
    
    	<h2 class="center"><?php _e('Nothing Found');?></h2>
    	<p class="center"><?php _e('Sorry, what you are looking for isn\'t here.');?></p>
    	<div class="center fix"><?php get_search_form(); ?></div>
    
    <?php endif; ?>
  2. hbalagh
    Member
    Posted 3 years ago #

    Nevermind, i realized i had this same issue a few years ago

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=-54&paged=$paged");
    }
    ?>

    was my answer

Topic Closed

This topic has been closed to new replies.

About this Topic