Bonjour,

j'ai un bout de code qui m'affiche un contenu selon la catégorie choisie !
Je boucle le tout avec un foreach, mais cela m'affiche chaque titre en double ainsi que chaque liste.
Mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$categories=  get_categories('child_of=9'); 
  foreach ($categories as $category) {
 
	$option = $category->cat_name;
 
 //echo '<p>'.$option.'</p>';
?><h1><?php echo $option ;?></h1><?php
 
 query_posts(array('post__not_in' => array(145),'category_name' => $option,'post_type'=>'retailers','orderby' => 'date', 'order' => 'ASC' , 'showposts' => $posts));
?>
 
<?php
   if (have_posts()) :
      while (have_posts()) : the_post();
		the_title();
		the_content();
  endwhile;
   endif;
   wp_reset_query();
 
 
 
query_posts(array('post__not_in' => array(145),'category_name' => $option,'post_type'=>'retailers','orderby' => 'date', 'order' => 'ASC' , 'showposts' => $posts));
?>
<h1><?php echo $option ;?></h1>
<?php
   if (have_posts()) :
      while (have_posts()) : the_post();
 
		the_title();
		the_content();
      endwhile;
   endif;
   wp_reset_query();
}
Le resultat me donne :
Caribbean

Miss Maes
Harbour Island
Bahamas

Swedish Design Center of Saint Barthélemy
Rue Général De Gaulle
97133 Gustavia, St Barth, FWI

Caribbean

Miss Maes
Harbour Island
Bahamas

Swedish Design Center of Saint Barthélemy
Rue Général De Gaulle
97133 Gustavia, St Barth, FWI

France

Addict
1 Rue Hôtel de Ville
13200 Arles

France

Addict
1 Rue Hôtel de Ville
13200 Arles
Comment eviter la repetition des H1 ? ainsi que du contenu ?