I've got a function going that shows all posts underneath the same custom taxonomy known as "problem". I have to adjust it to ensure that it further narrows it lower also to only display posts underneath the same category.

I required phone WordPress get_the_category() function but did not cash luck with this.

This is actually 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 can correctly show the present category id:

<?php
$category = get_the_category(); 
echo $category[0]->cat_id;
?>

And So I attempted editing the very first batch of code to simply show posts inside the current category id however 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 actually the get_the_category function reference: http://codex.wordpress.org/Function_Reference/get_the_category

Any help could be greatly appreciated.

Thanks,

Wade

get_the_term_list() returns an html string, not ID's of related groups. Then when you pass $issueid to get_posts(), you're including an html string, no integer. In my opinion the main reason you are receiving all posts came back happens because Wordpress is disregarding that question var since it is not what its expecting.

You need to use get_posts() and can include the ID for 'issue' to obtain all posts designated the course of 'issue'.

You need to use get_the_category() to obtain all groups associated with a publish.

Are you able to clarify if you wish to show all posts underneath the same groups because the current publish that is underneath the category 'issue'? Would you like to list the attached posts immediately after the present publish, or would you like to display All of the related posts All of the 'issue' posts within the sidebar?