• Hello everyone,

    Heres the issue at hand.

    ive got a search function at the beginning of the page and later down ive got a query function that basically pulls out the latests posts from a specific category. However when i do a search, it displays all the results in that category for no reason.

    But when i remove the query function, the search function works perfectly.

    The search code is the default that usually comes with wordpress and the custom display specific category code is as follows:

    <?php query_posts('cat=3&showposts=5'); ?>
    
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;?>
    </ul>

    It seems as if that code needs to be closed somewhere.

    Could someone help me figure this out.

    Thanks

Viewing 1 replies (of 1 total)
  • I too would like to know this. Does query_posts() contaminate the search function?

    My sidebar.php is heavily modified (query_posts is called twice) and the default WP search function doesn’t work as expected. I have done a number of test searches in which I copy text directly from the content of a published post…and it is no where to be found in the search results. It also seems to have more luck finding matches from a year ago than anything recent. Anyway…any thoughts on these issues?

Viewing 1 replies (of 1 total)
  • The topic ‘Search Function and Query Posts Conflict’ is closed to new replies.