Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Following is the code of my archive.php I want to display 8 posts at top which are in "featured" category AND current archive term (current archive term can be category, custom taxonomy or tag).

<article class="article">
        <div id="content_box">
                <h1 class="postsby">
                    <?php if (is_category()) { ?>
                        <span><?php single_cat_title(); ?><?php _e(" Archive", "mythemeshop"); ?></span>
                    <?php } elseif (is_tag()) { ?> 
                        <span><?php single_tag_title(); ?><?php _e(" Archive", "mythemeshop"); ?></span>
                    <?php } elseif (is_author()) { ?>
                        <span><?php _e("Author Archive", "mythemeshop"); ?></span> 
                    <?php } elseif (is_day()) { ?>
                        <span><?php _e("Daily Archive:", "mythemeshop"); ?></span> <?php the_time('l, F j, Y'); ?>
                    <?php } elseif (is_month()) { ?>
                        <span><?php _e("Monthly Archive:", "mythemeshop"); ?>:</span> <?php the_time('F Y'); ?>
                    <?php } elseif (is_year()) { ?>
                        <span><?php _e("Yearly Archive:", "mythemeshop"); ?>:</span> <?php the_time('Y'); ?>
                    <?php } ?>
                </h1>
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                    <div class="post excerpt">                                                          <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">
                            <?php if ( has_post_thumbnail() ) { ?> 
                            <?php echo '<div class="featured-thumbnail">'; the_post_thumbnail('featured',array('title' => '')); echo '</div>'; ?>
                            <?php } else { ?>
                            <div class="featured-thumbnail">
                            <img width="145" height="100" src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
                            </div>
                            <?php } ?>
                            </a>
                        <div class="post-content image-caption-format-1">
                            <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><b><?php the_title(); ?></b></a>: <?php echo excerpt(13);?>
                        </div>

                    </div><!--.post excerpt-->
                <?php endwhile; else: ?>
                    <div class="post excerpt">
                        <div class="no-results">
                            <p><strong><?php _e('There has been an error.', 'mythemeshop'); ?></strong></p>
                            <p><?php _e('We apologize for any inconvenience, please hit back on your browser or use the search form below.', 'mythemeshop'); ?></p>
                            <?php get_search_form(); ?>
                        </div><!--noResults-->
                    </div>
                <?php endif; ?>

                        <?php pagination($additional_loop->max_num_pages);?>

        </div>
    </article>
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.