• I use the following function

    function wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 6, $always_show = false) {
    	global $request, $posts_per_page, $wpdb, $paged;
    	if(empty($prelabel)) {
    		$prelabel  = '‹ Previous';
    	}
    	if(empty($nxtlabel)) {
    		$nxtlabel = 'Next ›';
    	}
    	$half_pages_to_show = round($pages_to_show/2);
    	if (!is_single()) {
    		if(!is_category()) {
    			preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
    		} else {
    			preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
    		}
    		$fromwhere = $matches[1];
    		$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
    		$max_page = ceil($numposts /$posts_per_page);
    		if(empty($paged)) {
    			$paged = 1;
    		}
    		if($max_page > 1 || $always_show) {
    			echo "$before <div class='Nav'><span>Go to page: </span>";
    			if ($paged >= ($pages_to_show-1)) {
    				echo '<a href="'.get_pagenum_link().'">&laquo; First</a> ... ';
    			}
    			previous_posts_link($prelabel);
    			for($i = $paged - $half_pages_to_show; $i  <= $paged + $half_pages_to_show; $i++) {
    				if ($i >= 1 && $i <= $max_page) {
    					if($i == $paged) {
    						echo "<strong class='on'>$i</strong>";
    					} else {
    						echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
    					}
    				}
    			}
    			next_posts_link($nxtlabel, $max_page);
    			if (($paged+$half_pages_to_show) < ($max_page)) {
    				echo ' ... <a href="'.get_pagenum_link($max_page).'">&raquo;</a>';
    			}
    			echo "<div class='NavEnd'></div></div> $after";
    		}
    	}
    }

    Pagination works correctly and is displayed on for search, categories etc.

    BUT is not displayed for tag pages. I only have a common archive.php file so that can’t be the issue.

    Help!!!

    apologies for double posting this, I accidentally replied to my message so it was lost.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Any reason why you are writing a function rather than writing the pagination into the loop code in the template?

    Thread Starter sibyy

    (@sibyy)

    I bought the template and edited it to my liking. Is it more efficient to include on each individual template?

    Any apparent mistake in the code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination not appearing on tag pages’ is closed to new replies.