Support » Themes and Templates » search.php only show headlines of PAGES??

  • hey guys,
    i wonder how i could solve the following problem:
    my search.php uses <?php the_excerpt(); ?> to show the search results. If the search-query also shows PAGE-results (not only single-posts) the excerpt of a page might look weird, due to the fact, that most of my pages use listings and so the excerpt gets abnormal long and bursts the website.

    I wonder if I could somehow exclude the_excerpt of Pages in the search-results and show only the Headlines (permalinks) of PAGES???

    Is this even possible?

Viewing 1 replies (of 1 total)
  • You want to display only the post title on the search result?

    Try this to your search.php

    <?php if (have_posts()) : ?>
    		<h2 class="pagetitle">Search Results</h2>
    		<?php while (have_posts()) : the_post(); ?>
    			<div <?php post_class() ?>>
    				<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    		<?php endwhile; ?>
    	<?php else : ?>
    		<h2 class="center">No posts found. Try a different search?</h2>
    		<?php get_search_form(); ?>
    	<?php endif; ?>

    But make sure you have a backup of your original search.php

    Hope this would help..

Viewing 1 replies (of 1 total)
  • The topic ‘search.php only show headlines of PAGES??’ is closed to new replies.