• I am currently having a hard time, basically I am using the codes below in which it gets the deals categories and location using taxonomies. The only thing is since it is paged every time it clicks on the next page it doesn’t use the same category?

    $deal_category_array = get_term_by('id', $deal_category_id, 'deal_categories', 'ARRAY_A');
    	$deal_location_array = get_term_by('id', $deal_location_id, 'deal_locations', 'ARRAY_A');
    
    	$deal_cat_title = $deal_category_array[name];
    	$deal_loc_title = $deal_location_array[name];
    
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	query_posts( array ( 'post_type' => 'deals','deal_categories' => $deal_cat_title, 'deal_locations' => $deal_loc_title, 'posts_per_page' => 1, 'paged' => $paged ) );
    	$deals_count = 0;
    	while(have_posts()) : the_post();
    		$deals_count++;
    		$permalink = get_permalink();
    		$deal_ID =  get_the_ID();
            $company = get_post_meta($deal_ID,'_company_meta',TRUE);
    		$company_ID = $company['company'];
    		$company_link =  get_permalink($company_ID);
    		echo '<div class="deal">';
    			if(has_post_thumbnail() && !is_single()){
    				echo '<div class="post_thumbnail"><a href="'.$company_link.'">'.get_the_post_thumbnail().'</a></div>';
    			}elseif(!has_post_thumbnail() && !is_page()){
    				echo '<div class="post_thumbnail post_thumbnail_no_image">'.get_the_post_thumbnail().'</div>';
    			}
    			echo '<div class="deal_content"><h3 class="deal_title"><a href="'.$company_link.'">';
    			the_title();
    			echo '</a></h3><div class="deal_excerpt">';
    			the_excerpt();
    			echo '<div class="details_button"><a href="'.$company_link.'">Details</a></div>';
    			echo '</div></div><div class="clr"></div>';//end of deal_content
    
    		echo '</div>';//end of deal
    	endwhile; 
    
    	if(!$deal_category_id && !$deal_location_id){
    		$deal_label = 'All Deals </p>';
    	}else{
    		if($deal_location_id == '-1'){
    			$deal_label = $deal_cat_title.' Deals </p>';
    		}else{
    			$deal_label = $deal_cat_title.' Deals in '.$deal_loc_title.'</p>';
    		}
    	}
    
    	echo '<p id="browse_deal_title"><span>Browse</span> '.$deal_label;
    	if($deals_count == 0){
    				echo '<h3 class="deal_notifier">There are no matching deals found.</h3>';
    			}
    	?>
        	<div class="clr"></div>
        </div>
        </div>   
    
    	<div class="deal_navigation">
    
        	<div class="previous_page"><?php previous_posts_link('&laquo; Previous Page', '') ?></div>
    
            <div class="next_page"><?php next_posts_link('Next Page &raquo;', '') ?></div>
            <div class="clr"></div>
        </div>
    	<?php

    Is there a way to make the functions next_posts_link and previous_posts_link to act like next_post_link and previous_post_link where you can just add the “TRUE” if they are in the same category?

    Something like this:

    <?php next_posts_link(‘Next Page »’, ”,TRUE) ?>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘prev_posts_link and next_posts_link in the same category’ is closed to new replies.