• Resolved bespokeordie

    (@bespokeordie)


    Hello! I happened to notice that while all the other archives searches work fine, when I click on a tag (like “shoes for example) the pagination (hard-coded into my theme) does not appear. Am I missing something in the .php script? Here is the code:

    <?php get_header(); ?>
    
    	<!-- Middle Starts -->
    	<div id="middle-out-top">
    	<div id="middle-out-bottom">
    	<div id="middle-content">
    	<div id="middle-content-bottom">
    		<!-- Content Starts -->
    		<div id="content" class="wrap">
    			<div class="col-left">
    				<div id="main-content">
    
    				<?php if (have_posts()) : ?>
    				<?php $post = $posts[0]; ?>
    
    				<?php if (is_category()) { ?><h2 class="arh">Archive for '<?php echo single_cat_title(); ?>'</h2>
    				<?php } elseif (is_day()) { ?><h2 class="arh">Archive for <?php the_time('F jS, Y'); ?></h2>
    				<?php } elseif (is_month()) { ?><h2 class="arh">Archive for <?php the_time('F, Y'); ?></h2>
    				<?php } elseif (is_year()) { ?><h2 class="arh">Archive for the year <?php the_time('Y'); ?></h2>
    				<?php } elseif (is_author()) { ?><h2 class="arh">Archive by Author</h2>
    				<?php } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?><h2 class="arh">Archives</h2>
    				<?php } elseif (is_tag()) { ?><h2 class="arh">Tag Archives: <?php echo single_tag_title('', true); ?></h2>	
    
    				<?php } ?>
    
    				<?php while (have_posts()) : the_post(); ?>
    
    				<!-- Latest Starts -->
    					<div class="archives post wrap">
    
    						<div class="block">
    
    							<?php woo_get_image('image','thumbnail','','','thumbnail alignleft'); ?>
                                <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    							<p class="post-details">Posted on <?php the_time('d. M, Y'); ?> by  <?php the_author_posts_link(); ?>.</p>
    							<div class="comment-cloud">
    								<a href="<?php comments_link(); ?>"><?php comments_number('0','1','%'); ?></a>
    							</div>
    
    							<?php
    							// If this is the video category
    							if ( is_category($GLOBALS[vid_cat]) ) {
    
    								// Check if excerpt is set which should hold alternative embed code with larger video size
    								$video_large = get_the_excerpt();
    								if ($video_large)
    									echo '<p>'.$video_large.'</p>';
    								else
    									the_content();
    
    							} else {
    
    								if ( get_option('woo_content_archives') )
    									the_content('[...]');
    								else
    									the_excerpt(); 
    
    							}
    							?>
    
                                <h4 class="continue"><a href="<?php the_permalink() ?>">Continue Reading</a></h4>
    						</div>
    
    					</div>
    					<!-- Latest Ends -->
    
    				<?php endwhile; ?>
    				<div class="more_entries wrap">
    					<?php if (function_exists('wp_pagenavi')) { ?><?php wp_pagenavi(); ?><?php } ?>
    				</div>
    
    				<?php endif; ?>
    
    				</div>
    			</div>
    
    			<div class="col-right">
    				<?php get_sidebar(); ?>
    			</div>
    		</div>
    		<!-- Content Ends -->
    	</div>
    	</div>
    	</div>
    	</div>
    	<!-- Middle Ends -->
    	<?php get_footer(); ?>

    Any help anyone could provide would be greatly appreciated.

    http://www.bespokeordie.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • It looks like your themes uses Lester Chan’s page naviplugin due to this line:

    <?php if (function_exists('wp_pagenavi')) { ?><?php wp_pagenavi(); ?>

    Do you have that plugin activated?

    Also if you don’t have enough posts under a tag the pagination won’t appear because there is no need for it to. For example if for the tag “Dog” and have three posts under it. And in your Settings >> Reading you have set atleast 10 posts to show per page then until you have 11 posts under the “Dog” tag – no pagination will appear. If you want to check if this is the case, go to settings >> reading and type 1 for “Blog pages show at most” and then click on a tag that you have at least two or more posts ascribed to. The pagination should be there now.

    Thread Starter bespokeordie

    (@bespokeordie)

    Thanks for the help. I don’t use Lester Chan’s plugin, but essentially the same code is hardcoded in to the theme. Using his plugin causes a fatal error.

    I have specifically tried this on Tags where I know there should be several pages. Like “shoes” for example. Yet, still no luck. weird.

    Thread Starter bespokeordie

    (@bespokeordie)

    bumpy

    Hey bespokeordie-

    I just ran into the same problem and found a solution. I am also not using the Naviplugin, but it turns out my theme includes bits of it in the functions.php file, including the wp_pagenavi function.

    The problem in my case was that the version of wp_pagenavi in my functions file was a little wonky. It tried to determine how many posts matched on its own rather than just checking with wp_query to see what it thought. Given that wp_query has the actual results, it seems safer to trust it.

    So, I comments out the lines that tried to determine number of posts and replaced them with:

    $numposts = $wp_query->found_posts;

    I also had to add $wp_query to the global list at the start of the wp_pagenavi.

    This worked for me. Ah, the fun of working with a free theme.

    I hope this helps.

    -John.

    cleverdaisies

    (@cleverdaisies)

    Thank you John! This helped me with a site I am working on.

    Have a great day.
    Meghan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tag Archive Pagination…’ is closed to new replies.