loop error for search and archive ?
-
on this archive page i want the posts to have different bottom lines. i tried this with this loop:
<?php /** * @package WordPress * @subpackage Default_Theme */ get_header(); ?> <div id="content"> <?php if (have_posts()) : ?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <br /> <br /> <h6>l'archive ‘<?php single_cat_title(); ?>’</h6> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <br /> <br /> <h6>mot-clef: ‘<?php single_tag_title(); ?>’</h6> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <br /> <br /> <h6>l'archive de <?php the_time('F Y'); ?></h6> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h6>l'archive de <?php the_time('Y'); ?></h6> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h6>archives</h6> <?php } ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« des articles plus vieux') ?></div> <div class="alignright"><?php previous_posts_link('des articles plus recents »') ?></div> </div> <?php while (have_posts()) : the_post(); ?> <div class="post"> <div class="title-after"><h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3></div> <div class="post-content"> <?php the_excerpt(); ?> </div> <!-- post content --> <?php // articles with a certain category get a certain footer: if (is_category('actualites') || is_category('films') || is_category('ressources') ) { ?> <div class="post-after"> <small><b>:: </b><b><?php the_category(' ', ', ', ' '); ?> <?php the_time('d/m/Y') ?></b> [ <?php edit_post_link(__('EDIT') ); ?> ] <?php comments_popup_link('Sans Commentaires »', '1 Commentaire »', '% Commentaires »'); ?> </small> </div> <?php } else { ?> <div class="post-after"> <small><?php edit_post_link(__('EDIT') ); ?></small> </div> <?php } ?> <hr/> </div> <!-- post --> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« des articles plus vieux') ?></div> <div class="alignright"><?php previous_posts_link('des articles plus recents »') ?></div> </div> <?php else : if ( is_category() ) { // If this is a category archive printf("<h2 class='center'>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false)); } else if ( is_date() ) { // If this is a date archive echo("<h2>Sorry, but there aren't any posts with this date.</h2>"); } else if ( is_author() ) { // If this is a category archive $userdata = get_userdatabylogin(get_query_var('author_name')); printf("<h2 class='center'>Introuvable ... </h2>", $userdata->display_name); } else { echo("<h2 class='center'>No posts found.</h2>"); } get_search_form(); endif;?> </div> <!-- content --> <?php get_footer(); ?>but somehow it’s not working … only the second bottom line is used 🙁
any idea why ? having same problem on search results …
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘loop error for search and archive ?’ is closed to new replies.