The following displays a parent term in a custom taxonomy, then displays the child terms and finally is intended to display the post links (custom posts) for the posts attached to each term. Thus:
Parent
- Child 1
- Post 1.1
- Post 1.2
- Child 2
- Post 2.1
etc.
etc.
- Post 2.1
However, the query is returning no posts. I'd appreciate any pointers as to the source of the problem. For the sake of brevity I've omitted the set up list of variables that precedes this code.
echo("<h3 class='chapter-header'id='".$chapterNumber."'>". $chapter_info->name . "</h3>");
echo("<div class='section' id=".$in_chapter.">"); // Start sections Div.
foreach ($sections as $section){
echo("<h3 class='section-header'>". $section->name."</h3>");// Display Section Name
$pagequery=NULL;
$postqueryargs = array(
'post_type'=>'book',
'taxonomy'=> $taxonomy,
'terms'=> $section->slug
);
$pagequery = new WP_Query($postqueryargs);
echo("<div class='pages'>");// Start pages div
echo("<ul>");
if($pagequery->have_posts()){
while ($pagequery->have_posts()):$pagequery->the_post();
echo('<li><a href=" '.get_permalink().'" rel="bookmark" title="Permanent Link to '. get_the_title().'" >' .get_the_title() . '</a></li>');
endwhile;}
else{
echo("No Pages Yet In This Chapter");
}
echo("</ul>");
echo("</div>");/* End pages */
}// End foreach - Sections
echo("</div>");/* End section */