Lists posts in current category and mqTranslate
-
Quick question: In single.php I am listing all other posts in the category except the current one. Problem is, mqTranslate is listing all posts in the category in all languages. How can I list just posts in the current category only in the current language?
This is the sidebar code I am using:
<?php $orig_post = $post; global $post; $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> 20, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $my_query = new wp_query( $args ); if( $my_query->have_posts() ) { echo '<div class="related_posts">'; while( $my_query->have_posts() ) { $my_query->the_post();?> <div class="related-items"> <ul> <li class="relatedcontent-side"> <a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> </li> </ul> </div> <? } echo '</div>'; } } $post = $orig_post; wp_reset_query(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Lists posts in current category and mqTranslate’ is closed to new replies.