• Hello,
    I have problem to put code.
    Full code index.php:

    <div class="smart_content" align="center">
    <div align="left">
    <?php if(is_tag()){
            }
            elseif (is_search() || is_tax()) {
            include (TEMPLATEPATH . '/search-result.php');
            }
            else {query_posts(array('orderby' => 'rand'));}?>
    </div>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php include TEMPLATEPATH.'/product.php'; ?>
    <?php endwhile; ?><div class="clear"></div>
    <?php { wp_pagenavi(); } ?>
          <?php else : ?>
    	<h2>Not Found</h2>
    	<div class="bodycontent">Sorry, but you are looking for something that isn't here.</div>
          <?php endif; ?>
    </div>

    Here the problem:

    <?php if(is_tag()){
            }
            elseif (is_search() || is_tax()) {
            include (TEMPLATEPATH . '/search-result.php');
            }
            else {query_posts(array('orderby' => 'rand'));}?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php include TEMPLATEPATH.'/product.php'; ?>
    <?php endwhile; ?>

    I know the wrong is put
    <?php if(is_tag()) ....
    before the post <?php if (have_posts())
    So, my search is double result. First result is what I want, the template is (TEMPLATEPATH . '/search-result.php') but after the footer I get same result with template <?php include TEMPLATEPATH.'/product.php'; ?>.

    How I put the right code structure to get the right search result with templatepath search-result.php?

  • The topic ‘Search Loop Double Result – Template Editing’ is closed to new replies.