• Hi,
    I am trying to create a conditional statement that would filter search results, but am having no luck. Here is what I would like to do: If the search results include a certain page template I want the results to NOT include a link to the page. I know I am missing something because the search page itself is obviously not the template, but I need the search results to filter if that page template is called upon. Here is the code I have:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class=”entry-search”>
    <div class=”border”>
    <div class=”bottom”>
    <div class=”entry-content-search clearfix”>

    <?php if ( is_page_template(‘page-three-column.php’) ) { ?>

    <div class=”text-search”>
    <h3 class=”title”><?php truncate_title(100); ?></h3>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “c-phone”, true); ?></div>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “d-address”, true); ?></div>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “e-web”, true); ?>
    </div>

    <?php the_excerpt(); ?>
    </div>
    <div class=”linebtm”>
    </div>

    <?php } else { ?>
    <div class=”text-search”>
    <h3 class=”title”>“><?php truncate_title(100); ?></h3>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “c-phone”, true); ?></div>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “d-address”, true); ?></div>
    <div class=”lcp-search”><?php echo get_post_meta($post->ID, “e-web”, true); ?>
    </div>

    <?php the_excerpt(); ?>
    </div>
    <div class=”linebtm”>
    </div>
    <?php } ?>

    And the site is http://www.jhskier.net. The reason I need this filtered is because I setup pages that are hidden. I still want them to be searchable, but I don’t want them to be clickable to the actual page (as those pages appear blank). Any help would be very much appreciated!

  • The topic ‘Edit Search Results by page template’ is closed to new replies.