<?php
// Here is the call to only make two posts show up on the homepage REGARDLESS of your options in the control panel
query_posts('showposts=2');
?>
<?php if (have_posts()) : ?>
<?php $first = true; ?>
<?php while (have_posts()) : the_post(); ?>
<div class="story<?php if($first == true) echo " first" ?>">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt() ?>
<div class="details">
Posted at <?php the_time('ga \o\n n/j/y') ?> | <?php comments_popup_link('no comments;', '1 comment', '% comments'); ?> | Filed Under: <?php the_category(', ') ?> | <span class="read-on"><a href="<?php the_permalink() ?>">read on</a></span>
</div>
</div>
<?php $first = false; ?>
<?php endwhile; ?>
Alles anzeigen
So stehts in der index.php. Das muss dann folgendermaßen verändert werden:
<?php
// Here is the call to only make two posts show up on the homepage REGARDLESS of your options in the control panel
query_posts('cat=1&showposts=1');
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="story first">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt() ?>
<div class="details">
Posted at <?php the_time('ga \o\n n/j/y') ?> | <?php comments_popup_link('no comments;', '1 comment', '% comments'); ?> | Filed Under: <?php the_category(', ') ?> | <span class="read-on"><a href="<?php the_permalink() ?>">read on</a></span>
</div>
</div>
<?php endwhile; endif; ?>
<?php $my_query = new WP_Query('cat=2&showposts=1'); ?>
<?php if($my_query->have_posts()) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="story">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt() ?>
<div class="details">
Posted at <?php the_time('ga \o\n n/j/y') ?> | <?php comments_popup_link('no comments;', '1 comment', '% comments'); ?> | Filed Under: <?php the_category(', ') ?> | <span class="read-on"><a href="<?php the_permalink() ?>">read on</a></span>
</div>
</div>
<?php endwhile; endif; ?>
Alles anzeigen
cat=1 und cat=2 müssen noch an die Kategorien angepasst werden. Der Einfachheit halber bin ich mal davon ausgegangen, dass in den Kategorien auch Postings sind und daher eine else Bedingung bei der If-Schleife nicht greifen muss.
Das ist jetzt mal so eben aus den Fingern gesaugt, ich übernehme keine Garantie das das funktioniert. Wie immer, schön Backup machen :D
Gruß Jeriko