Open result links in same window

Forums › Forums › Search & Filter Pro › Open result links in same window

Viewing 10 posts – 1 through 10 (of 13 total)
  • Anonymous
    #187954

    Can I change the settings so when a result is clicked, it opens in the same window instead of a new tab?

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() )
    {
    	?>
    	<div class="results-found">
    	Found <?php echo $query->found_posts; ?> Results<br /></div>
    	<div class='search-filter-results-list'>
    	<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>
    			<div class='search-filter-result-item'>
    				
    				<?php 
    					if ( has_post_thumbnail() ) {
    						echo '<p>';
    						the_post_thumbnail("small");
    						echo '</p>';
    					}
    				?>
    				<h2><a>",><?php the_title(); ?></a></h2>
    						
    				</div>
    			
    			<?php
    		}
    	?>
    	</div>
    <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
    Trevor
    #187961

    You have a page of results and when you click to one of them you want it to open in the same window/tab?

    Are you able to send me a live link/URL to your search page so I can take a look?

    Having said that, opening in new or current window/tab behavior tends these days to be a browser setting made by the user, and not set by the page HTML.

    Anonymous
    #188108

    Hi Trevor. Yes when a user clicks one of the results, I’d like it to open in the same tab instead of opening a new one. Here is the live page https://miamicirclemarble.com/browse-colors/?_sfm_stock=New%20Arrival. Thanks for the information on the browser settings. If there’s anything I can do to try to make it default to the same window, though, I’d appreciate it.
    Thanks!

    Trevor
    #188176

    Are you able to share with me the contents of the customised results.php file that you are using?

    Anonymous
    #188210

    Yes that is posted in my first post.

    Trevor
    #188222

    Ah, it wasn’t inside code backticks, so our forum software has mangled it. I tried to recover it, but it is still incomplete.

    On my keyboard the back tick is on the key to the left of the 1 key. It needs one before all the code, and then one after.

    Anonymous
    #188335
    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() )
    {
    	?>
    	<div class="results-found">
    	Found <?php echo $query->found_posts; ?> Results<br /></div>
    	<div class='search-filter-results-list'>
    	<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>
    			<div class='search-filter-result-item'>
    				
    				<?php 
    					if ( has_post_thumbnail() ) {
    						echo '<p>';
    						the_post_thumbnail("small");
    						echo '</p>';
    					}
    				?>
    				<h2><a href="<?php the_permalink(); ?>",><?php the_title(); ?></a></h2>
    						
    				</div>
    			
    			<?php
    		}
    	?>
    	</div>
    <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
    
    Trevor
    #188345
    This reply has been marked as private.
    Anonymous
    #188349
    This reply has been marked as private.
    Trevor
    #188355
    This reply has been marked as private.
Viewing 10 posts – 1 through 10 (of 13 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.