Exclude content from search results
-
I would like to edit my search functions to only show search results for my posts titles. I had my theme designed for me so things are a bit different than a typical theme. My search.php file looks like this:
<? get_header()?> <div id="sub_header"> <?php include (TEMPLATEPATH . '/includes/search_form.php'); ?> </div> <div id="content"> <div id="left_2_col"> <div id="search_results"> <h2 class="search_results">Search Results</h2> <div id="search_results_top"></div> <h3>Search Results for "<?= get_search_query() ?>". <!-- <span class="showing">Showing 0 - 0 of 0.</span>--></h3> <? if (have_posts()) : ?> <table> <tr> <th>Title</th> <th>Post Date</th> <th>Category</th> </tr> <? $i = 0; while (have_posts()) : the_post(); $i++; ?> <tr <?=((($i % 2) == 1) ? "class=\"alt\"" : NULL)?>> <td> <a href="<? the_permalink() ?>" rel="bookmark" title="Permanent Link to <? the_title_attribute() ?>"><? the_title() ?></a> </td> <td> <? the_time('F j, Y') ?> </td> <td> <? if (get_post_meta($post->ID, 'mf_page_type', TRUE) == "Blog") echo "Blog"; ?> <? if (get_post_meta($post->ID, 'mf_page_type', TRUE) == "News") echo "News"; ?> </td> </tr> <? endwhile; ?> </table>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Exclude content from search results’ is closed to new replies.