• Resolved do77

    (@do77)


    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)
Viewing 1 replies (of 1 total)

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