Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGonzaloº Caminos
2,231 PointsLoop for Featured post section in my WordPress Theme
Hi. I am making a WordPress Theme with this Foundation Template:
http://foundation.zurb.com/templates-previews-sites-f6/news-magazine.html
I need to make a featured post section but the problem is that the post thumbnail images has different sizes.
Promoted Article is a big picture but not the rest of the featured section (Other Cool Articles).
How can i use the loop for get the post from the featured category in different sizes? I ' m tried with WP_Query but i obtain the same post again... this is the code:
<div class="row">
<?php
// WP_Query arguments
$args = array (
'posts_per_page' => '1',
);
$miQuery = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $miQuery->have_posts() ) : $miQuery->the_post(); ?>
<div class="medium-8 columns">
<?php the_post_thumbnail('large')?>
<?php rewind_posts(); ?>
</div>
<div class="medium-4 columns">
<?php the_post_thumbnail('large')?>
</div>
<?php endwhile; endif; ?>
</div>
Sorry for my english...
2 Answers
Gonzaloº Caminos
2,231 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsYou could supply different arguments in a slightly different post template. You'll need to study the template hierarchy to see if you can do this so one template would be for your promoted article and featured category article.
So it'll be 2 templates for 2 different purposes.
Gonzaloº Caminos
2,231 PointsOnly the featured post section is the problem because the posts has different sizes. One big image for one post, and other medium image for another.