Title: Problem featured posts when using children category
Last modified: August 19, 2016

---

# Problem featured posts when using children category

 *  Resolved [do77](https://wordpress.org/support/users/do77/)
 * (@do77)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/problem-featured-posts-when-using-children-category/)
 * Hi,
    I have a problem with my featured posts when I am using a children category.
   First of all here is my code:
 *     ```
       <ul class="latest">
       <?php $feature_post = get_posts( 'category=15&numberposts=1' ); ?>
       <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?>
       <li><h2 class="latest"><?php the_category(' '); ?></h2></li>
       <?php endforeach; ?>
       <?php $feature_post = get_posts( 'category=15&numberposts=3' ); ?>
       <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?>
       <?php if (function_exists('c2c_get_custom')) : ?>
        <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
       		<?php echo c2c_get_custom('post-image','<img src="','" alt="<?php the_title(); ?>" class="post-image" />',''); ?></a></li>
       <?php endif; ?>
         		<li class="list-time"><?php the_time('d'); ?>.<?php the_time('M'); ?></li>
         		<li class="list-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><br />              <small>by  <?php the_author_posts_link(); ?></small></li>
         		<li class="latest-excerpt"><?php the_excerpt(); ?></li>
       <?php endforeach; ?>
       </ul>
       ```
   
 * Right now it is set up that I will feature 3 Posts of category 15 on my homepage.
   The problem is that when I post in a subcategory of cat 15, it will display the
   the subcategorie’s name in <h2></h2> and the article but will continue with 2
   articles from the main category, thus it looks like the two other featured articles
   belong to the subcategory but they don’t. How can I change the code so that in
   case I post in a subcategory it will feature 3 posts from the same category?
 * Hope someone has an idea!
    do77

Viewing 1 replies (of 1 total)

 *  Thread Starter [do77](https://wordpress.org/support/users/do77/)
 * (@do77)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/problem-featured-posts-when-using-children-category/#post-1000363)
 * Anyone an idea?

Viewing 1 replies (of 1 total)

The topic ‘Problem featured posts when using children category’ is closed to new
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [do77](https://wordpress.org/support/users/do77/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/problem-featured-posts-when-using-children-category/#post-1000363)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
