WordPress.org

Support

Support » How-To and Troubleshooting » Search Results, weird search.php

Search Results, weird search.php

  • Hello all,

    My need is this. I want my search results page to show excerpts instead of full text. I have read all of the support forums and I know about the “the_excerpt” command, etc, but this does not apply to my page. I need some help to get my search results page to show the title of the post and excerpts only. I am going to paste the code of my page below. Any help would be greatly appreciated.

    Here comes the code:

    <?php /* Don’t remove this line. */ require(‘./wp-blog-header.php’); ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
    <html xmlns=”http://www.w3.org/1999/xhtml”>
    <head profile=”http://gmpg.org/xfn/1″>
    <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=<?php bloginfo(‘charset’); ?>” />
    <!– leave this for stats –>
    <style type=”text/css” media=”screen”>
    @import url( <?php bloginfo(‘stylesheet_url’); ?> );
    </style>
    <link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php bloginfo(‘rss2_url’); ?>” />
    <link rel=”alternate” type=”text/xml” title=”RSS .92″ href=”<?php bloginfo(‘rss_url’); ?>” />
    <link rel=”alternate” type=”application/atom+xml” title=”Atom 0.3″ href=”<?php bloginfo(‘atom_url’); ?>” />
    <link rel=”shortcut icon” href=”/favicon/bullet.ico” />
    <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />
    <?php //comments_popup_script(); // off by default ?>
    <?php wp_head(); ?>
    </head>
    <body>
    <div id=”rap”>
    <?php get_header() ?>
    <div id=”main”>
    <div id=”content”>
    <?php if ($posts) { ?>
    <?php $post = $posts[0]; /* Hack. Set $post so that the_date() works. */ ?>
    <h3>Here are the results for your search.</h3>
    <div class=”post-info”>Did you find what you wanted ?</div>
    <br/>
    <?php foreach ($posts as $post) : start_wp(); ?>
    <?php require(‘post.php’); ?>
    <?php endforeach; ?>
    <div class=”navigation”>
    <div class=”alignleft”><?php posts_nav_link(”,”,’« Older Entries’) ?></div>
    <div class=”alignright”><?php posts_nav_link(”,’Newer Entries »’,”) ?></div>
    </div>
    <?php } else { ?>
    <h2 class=”center”>Not Found</h2>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php } ?>
    </div>
    <div id=”sidebar”>
    <h2>Currently Browsing</h2>

    • <p>Here are the result of your search. If you are unable to find anything in these search results, try refining your search.</p>

    <?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>
    </div>
    </div>
    </body>
    </html>

    Thank in advance!

  • The topic ‘Search Results, weird search.php’ is closed to new replies.
Skip to toolbar