Hi,
I have a function going that displays all posts under the same custom taxonomy called "issue". I need to adjust it so that it further narrows it down to also only display posts under the same category.
I took a look at the WordPress get_the_category() function but didn't have much luck with that.
Here is the code:
<?php
$issueid = get_the_term_list( $post->ID, 'issue', '', ', ', '' );
$postslist = get_posts("numberposts=100&issue=$issueid");
foreach ($postslist as $post) :
setup_postdata($post); ?>
<div class="sidebar-box">
<div class="sidebar-left">
<p><a href="<?php echo get_page_link($page->ID) ?>"><?php the_title(); ?></a></p>
<p><?php the_date(); ?></p>
</div>
<div class="sidebar-right">
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
</div>
</div>
<?php endforeach; ?>
This will properly show the current category id:
<?php
$category = get_the_category();
echo $category[0]->cat_id;
?>
So I tried editing the first batch of code to only show posts within the current category id but it still returns everything:
$category = get_the_category();
$categoryid = $category[0]->cat_id;
$issueid = get_the_term_list( $post->ID, 'issue', '', ', ', '' );
$postslist = get_posts("numberposts=100&issue=$issueid&category=$categoryid");
foreach ($postslist as $post) :
setup_postdata($post); ?>
This is the get_the_category function reference: http://codex.wordpress.org/Function_Reference/get_the_category
Any help would be greatly appreciated.
Thanks,
Wade