Edit : ok everything works fine : i finally had to use taxonomies and get_terms, and putting everything in divs work better than lis. Thanks for your help.
Hi,
i have a problem with the categories and post thumbnail, my images are mixing up, the titles are OK, in the good order, but then the thumbnail of the first category goes under the second category title, and the second category thumbnail goes under the first title. I tried with "orderby" "name" on both get_categories or $second query but it's still the same : do you know how i could fix it?
<?php
<div id="cat-diapo">
<ul>
<?php
//$tout = wp_list_categories();
$tout = get_categories();
foreach ($tout as $tou){
$mon_id = $tou->cat_ID;
echo '<li>';
echo '<span>'.$tou->name.'</span>';
$argu = array ('cat'=>$mon_id);
$second = new WP_Query($argu);
while ($second->have_posts()) : $second->the_post();
$res = '<div class="sous-cat">'.the_post_thumbnail("mini", array("alt"=> the_post()->ID)).'</div>';
endwhile;
wp_reset_postdata();
}
echo '</li>';
and here's the markup :
<div id="cat-diapo">
<ul>
<li><span>Andalousia</span>
<img width="150" height="140" src="http://localhost:8888/espe/wp-content/uploads/2011/05/h.jpg" class="attachment-mini wp-post-image" alt="" title="h" />
<li><span>Spain</span>
<img width="150" height="123" src="http://localhost:8888/espe/wp-content/uploads/2011/05/Corida-65x811.jpg" class="attachment-mini wp-post-image" alt="" title="Corida - 65x81" />
<li><span>Another post</span>
<img width="150" height="213" src="http://localhost:8888/espe/wp-content/uploads/2011/05/p2-150x213.jpg" class="attachment-mini wp-post-image" alt="" title="p2" /></li>
So all the code php in my first post is wrapped by "ul" tags, and this gives me the code just above : this seems ok, but the image of "Andalousia" is under the title "Spain", and vice versa...
thanks a lot