Um den ersten Artikel auf der ersten Seite des Archivs optisch hervorzuheben habe ich mich der 5. Methode von Texto bedient.
Das hat auch ganz gut funktioniert, bis ich mal auf die 2. Seite des Archives blättern wollte, da steht dann "Sorry, keine Treffer". Diese Meldung stammt aus der dem else der 404.php
PHP
<?php
/**
404 Error */
get_header();
if (have_posts()) : while (have_posts()) : the_post();
?>
<div class="postWrapper" id="post-<?php the_ID(); ?>">
<h1 class="postTitle" >
Fehler 404 - Seite nicht gefunden
</h1>
<p class="center"><?php _e('Sorry, but you are looking for something that isn’t here.', 'kubrick'); ?></p>
<form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
<label class="noCss" for="s">Suchbegriff...</label>
<input type="text" name="s" id="s" value="Suchbegriff..." onclick='this.value = "";' size="15" />
<input type="submit" id="go" value="Los!" />
</form>
</div>
<?php
endwhile; else: ?>
<p>Sorry, keine Treffer</p>
<?php
endif;
get_footer();
?>
Alles anzeigen
Meine archive.php sieht so aus:
PHP
<?php
get_header();
$withcomments = 1;
?>
<ol id="posts"> <?php
$post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h1 class="pagetitle"><?php printf(__('Archiv der ‘%s’ Kategorie', 'kubrick'), single_cat_title('', false)); ?></h1>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h1 class="pagetitle"><?php printf(__('EintrÄge mit ‘%s’ getaggt', 'kubrick'), single_tag_title('', false) ); ?></h1>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h1 class="pagetitle"><?php printf(_c('Archiv vom %s|Daily', 'kubrick'), get_the_time(__('j. Y', 'kubrick'))); ?></h1>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h1 class="pagetitle"><?php printf(_c('Archiv vom %s|Monthly', 'kubrick'), get_the_time(__('F, Y', 'kubrick'))); ?></h1>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h1 class="pagetitle"><?php printf(_c('Archiv von %s|Yearly ', 'kubrick'), get_the_time(__('Y', 'kubrick'))); ?></h1>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h1 class="pagetitle"><?php _e('Author Archive', 'kubrick'); ?></h1>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h1 class="pagetitle"><?php _e('Blog Archive', 'kubrick'); ?></h1>
<?php } ?>
<?php $top_query = new WP_Query('showposts=1'); ?>
<?php while($top_query->have_posts()) : $top_query->the_post();
$do_not_duplicate = $post->ID; ?>
<div class="postWrapper" id="post-<?php the_ID(); ?>">
<div class="postTitle" >
<div class="date"><?php the_date('d M'); ?></div>
<h2><a class="title" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</div>
<div class="post"><?php the_content(__('')); ?></div>
<div class="postMeta">
<div class="autor">
<em><?php the_title(); ?></em>
geschrieben von <?php the_author(); ?>
(<?php the_author_posts(); ?> Artikel)
</div>
</div>
</div>
<?php
comments_template();?>
<?php endwhile; ?>
<?php $top_query = new WP_Query('showposts=2&offset=1'); ?>
<?php while($top_query->have_posts()) : $top_query->the_post();
$do_not_duplicate = $post->ID; ?>
<li class="postWrapper" id="post-<?php the_ID(); ?>">
<div class="postTitle" >
<div class="date"><?php the_date('d M'); ?></div>
<h2><a class="title" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<sup class="comments_number"><?php comments_number('0','1','%'); ?></sup>
</div>
<div style="clear:left;" class="post"><?php the_excerpt(__('weiterlesen')); ?></div>
</li>
<?php endwhile; ?>
</ol>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
<?php
get_footer();
?>
Alles anzeigen
Die Anzahl der Artikel pro Seite ist auf 10 eingestellt. Um der Frage vorzubeugen: Ja, es sind genug Artikel vorhanden um eine 2. Seite anzuzeigen. Sonst würde die wp_pagenavi gar nicht erst einen Link auf die 2. Seite setzen.
Ich hoffe mir kann jemand helfen :oops: Bin sehr dankbar dafür :)
Grüße
Jan