• Resolved dmitcha

    (@dmitcha)


    Hello, searching my blog results in full posts. I would like to return only post titles and excerpts for easier navigation. I cannot figure out how search is working within the theme. Here’s what I have if anyone can help:

    1) Theme – Minimalist Fever 10

    2) Search Structure:
    a. There is a search.php file but no searchform.php. Search.php is not being referenced because the page name “Search Results” does not appear over the results (just my blog title), and when I intentionally do a no results search, it does not show edits to the no results message or produce the search box that is coded in search.php.

    b. I am using the default search box in the sidebar

    c. I tried adding searchform.php from classic, but it still does not reference that file. When I modified search.php to reference “searchform.php” rather than “index.php,” I stopped getting results at all (no results found).

    3) Search files:

    Sidebar search box:

    • <h2>Search</h2>
    • <form id=”searchform” method=”get” action=”<?php echo get_settings(‘siteurl’); ?>/index.php”>
      <p><input type=”text” name=”s” size=”30″ /></p></form>

    Search.php:
    <?php get_header(); ?>

    <?php get_sidebar(); ?>

    <div id=”content”>

    <?php if (have_posts()) : ?>

    <h2 class=”pagetitle”>Search Results</h2>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>
    </div>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post”>
    <h3 id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h3>

    <p class=”postmetadata”><?php the_time(‘F jS, Y’) ?> | <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p>
    </div>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>
    </div>

    <?php else : ?>

    <h2>No posts found. Try a different search?</h2>
    <form id=”searchform” method=”get” action=”<?php echo get_settings(‘siteurl’); ?>/index.php”>
    <p>Search:  <input type=”text” name=”s” size=”15″ /></p></form>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    I cannot figure out the search structure to fix it. If anyone can see the problem, or knows of the file I should be posting to clear this up, I would really appreciate the guidance. Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter dmitcha

    (@dmitcha)

    I figured it out. If someone else is in the same spot, the answer is in the search.php file. The format of my results was determined by the posts code in the index.php file. I replaced “the_content” with “the_excerpt” and got exactly what I needed.

Viewing 1 replies (of 1 total)
  • The topic ‘Search Results – don’t appear to reference search.php’ is closed to new replies.