WordPress HowTo – die Startseite, Teil5
08/2008
Dieser Artikel ist Teil der Artikelserie WordPress HowTo
Alle Artikel:Das neueste Posting komplett (oder mit Auszug) sowie einige weitere aktuelle Postings dargestellt nur mit Titel – das ist die am häufigsten gewünschte Darstellung der Startseite. Je nachdem wie das Styling dieser Postings ausfällt, kann man damit vom beliebten Magazin-Style bis zum Business-Look alles hinkriegen.
Der dazugehörige Code ist recht einfach:
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 | <?php query_posts('showposts=1'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h2>Aktuell</h2> <div class="postindex"><!--beginn post--> <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link zu Post '<?php the_title_attribute(); ?>'"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> // oder the_excerpt </div> <p class="meta"> <?php the_time('d.m.Y') ?> | <?php echo 'Kategorie: '; the_category(', '); ?> </p> </div> <?php endwhile; ?> <div id="aktuelles"> <h2>... mehr Aktuelles:</h2> <ul id="aktuell_liste"> <?php query_posts("showposts=4&offset=1"); while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title() ?></a><br /> vom: <?php the_time('d.m.Y') ?> | Kategorie: <?php the_category(', ') ?> </li> <?php endwhile; ?> </ul> </div> <?php else : ?> <?php endif; ?> |
Den vorstehenden Code kann man auch ergänzen um bestimmte Kategorien auszuschließen (das X ist mit der jeweiligen Kategorie-ID zu ersetzen, mehrere Kategorien durch Beistrich getrennt ):
1 | <?php query_posts('category=-X&showposts=1'); ?> |
1 2 3 | <?php query_posts("category=-X&showposts=4&offset=1"); while (have_posts()) : the_post(); ?> |
--- ende artikel ---------------------------





kOmMeNtaR sChReIbEn: