Thema: Mehrere Loops
Einzelnen Beitrag anzeigen
Alt 19.02.2008, 15:43   #1 (permalink)
joachimott
PostRank: 2
 
Registriert seit: 01.03.2005
Beiträge: 61
Mehrere Loops

Hallo,

ich versuche, mit drei Loops Artikel aus jeweils einer Kategorie in der Sidebar darzustellen. Das Ganze funktioniert eigentlich - aber es werden nicht einmal drei Ergebnisse angezeigt, sondern dreimal drei.

Also

Artikel 1 stammt aus Kategorie 1
Artikel 2 stammt aus Kategorie 2
Artikel 3 stammt aus Kategorie 3

Artikel 1 stammt aus Kategorie 1
Artikel 2 stammt aus Kategorie 2
Artikel 3 stammt aus Kategorie 3

Artikel 1 stammt aus Kategorie 1
Artikel 2 stammt aus Kategorie 2
Artikel 3 stammt aus Kategorie 3

Was muss ich machen, demit ich das nur einmal habe? Ich bin PHP-Laie und habe mir das so zusammengestückelt. Der Code sieht so aus:

PHP-Code:
<h3>Aktuell</h3>

<?php $new_query = new WP_Query("cat=aktuell&showposts=1"); while($new_query->have_posts()) : $new_query->the_post();?>

<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<p id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Lesen Sie den ganzen Artikel...</a></p>
<?php endwhile; ?>

<h3>Termine</h3>
<?php rewind_posts('cat=termine&showposts=1'); ?>
<?php 
while(have_posts()) : the_post(); ?>

<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<p id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Lesen Sie den ganzen Artikel...</a></p>
<?php endwhile; ?>


<h3>Auszeichnungen</h3>
<?php rewind_posts('cat=6&showposts=1'); ?>
<?php 
while(have_posts()) : the_post(); ?>

<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<p id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Lesen Sie den ganzen Artikel...</a></p>
<?php endwhile; ?>

Geändert von Olaf (19.02.2008 um 17:06 Uhr). Grund: Code bitte IMMER markieren, denn dafür ist die Codemarkierung da!
joachimott ist offline   Mit Zitat antworten