Hi guys, I've been trying to create a featured posts section on my main index that will allow me to showcase only posts with a specific tag keyword on them (as opposed to categories, which most people do).
So far I have the following code, but I can't get it to work (I don't know if it's the markup or the functions).
What am I doing wrong?
?php if(is_home() && !get_query_var('paged')) : ?>
<!-- Featured / Top Articles // -->
<div class="ftop">
<?php if(is_tag('featured')) : ?>
<div class="featured articles article cat-<?php foreach((get_the_category()) as $cat) { echo $cat->category_nicename; } ?>">
<div class="fthumbs">
<?php $i = 0; $featured = new WP_Query("tag='featured'&showposts=4"); while($featured->have_posts()) : $featured->the_post();?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "thumbnail_top", true); ?>" alt="" <?php if($i == 0) echo 'class="active" '; ?>/></a><br />
<?php $i++; endwhile; $i = 0; ?>
</div>
<div class="fwrap">
<ul>
<?php $featured = new WP_Query("tag='featured'&showposts=4"); while($featured->have_posts()) : $featured->the_post();?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_post_meta($post->ID, "featured_thumbnail", true); ?>" width="630" height="230" /></a>
<div>