• Resolved frmars

    (@frmars)


    Hello

    I use a theme where it is the MAIN LOOP which performs and displays the search results.

    Extracted from my index.php :

    <?php if ( is_search() ) : ?>
            <h2> Results: "<?php the_search_query(); ?>":</h2>
            <?php endif; ?>

    Then the main loop starts.

    In other themes though, a separate “search.php” file displays the search (it usually contains another loop).

    I’ve been searching through all I could think ok , but I DO NOT UNDERSTAND how or where I can force my theme to branch towards another file and ignore the main loop.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Remove that code block from your main theme template file and create a search.php template file with its own Loop.

    Thread Starter frmars

    (@frmars)

    I see what you mean but :

    ? do i need to tell WP : “if the search field is used, then call search.php” ?

    (then I do not know to do that)

    ? or is “search.phpautomatically triggered when you fill in the form ?

    If you perform a search and search.php exists, it will automagically be used to handle the display of content.. ?? If not index.php is used..

    Thread Starter frmars

    (@frmars)

    tested successfully , thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search, search.php’ is closed to new replies.