Show Excerpt in Search except where condition is true
-
The script below is from a slightly customized search.php. I’d like to modify it so that the excerpt doesn’t show if it is a defined term.
e.g. in all circumstances I want the excerpt to show unless the excerpt is exactly ‘abcdef’.Any help greatly appreciated.
<?php /** * The template for displaying Search Results pages. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ get_header(); ?> <div id="container"> <div id="content" role="main"> <?php if (have_posts()) : ?> <h2 class="pagetitle">Search Results</h2> <?php while (have_posts()) : the_post(); ?> <div id="ge-search" <?php post_class() ?>> <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Go to <?php the_title_attribute(); ?>"> <?php the_title(); ?></a></h3> <? the_excerpt(); ?> </div> <?php endwhile; ?> <?php else : ?> <h2 class="center">No posts found. Try a different search?</h2> <?php get_search_form(); ?> <?php endif; ?> <h2 class="center">Another search?</h2> <?php get_search_form(); ?> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show Excerpt in Search except where condition is true’ is closed to new replies.