I’ve a mother or father class and a number of other youngster classes. I even have a number of posts that belong to the kid classes. Every publish could be belong to a number of classes. I need to know how one can question the publish desk so once I need to present all posts in mother or father class, I am going to get all of the publish beneath the kid classes. the outcome need to distinctive publish. Sorry for my dangerous english.
Right here is my code :
$cats = get_categories('child_of=95');
// loop via the categries
foreach ( $cats as $cat ) {
// setup the cateogory ID
$cat_id = $cat->term_id;
// Make a header for the cateogry
//echo "<h2>".$cat->title."</h2>";
// create a customized WordPress question
query_posts("cat=$cat_id&post_per_page=100");
// begin the wordpress loop!
if (have_posts()) : whereas (have_posts()) : the_post(); ?>
<?php // create our hyperlink now that the publish is setup ?>
<h2><?php the_title(); ?></h2>
<a href="<?php the_permalink();?>"><?php the_content(); ?></a>
<?php echo '<hr/>'; ?>
<?php endwhile; endif; // carried out our wordpress loop. Will begin once more for every class ?>
<?php } // carried out the foreach assertion ?>
However I at all times get the duplicate posts.