Forums › Forums › Search & Filter Pro › Problems with Search & Filter plugin and Avada theme
- This topic has 13 replies, 6 voices, and was last updated 6 years, 10 months ago by Trevor.
-
Anonymous(Private) December 17, 2014 at 10:00 am #9198
Hello,
Currently I’m using the plug-in Search&Filter in Avada Theme and I’m having problems with it as follows…
When I search something using this plug-in, and choosing free search option (in this plug-in), the behavior is that the search is normal search in Avada and is not taking into account other filters introduced using the plug-in. It seems that is not using the Search&Filter.
To see an example of this behabior, just check it here in this URL:
http://prensagnftest.azurewebsites.net/?sfid=3134&s=cine&_sfm_wpcf-seccion=2&post_date=24122014
If you put a value in the free search field you will be returned results without taking into account the other introduced filters.
So the question here is to know if is possible to use the filter search instead of Avada search in this case and apply filters I’ve defined (now is like is not taking these filters into account).
Thank you very much for your help.
Best regards…
Ross Moderator(Private) December 17, 2014 at 10:51 am #9200Hey Javier
Avada, by default, creates its own custom queries within its template files – which will overwrite any queries made by Search & Filter.
To get around this (also applies to some other themes) you need to look for
query_posts
,get_posts
,WP_Query
in your template and remove it.What I do in Avada to make it work is, duplicate
search.php
and call itsearch-filter-results.php
, on around line71
there is aquery_posts
– I simply remove this line – then in S&F settings, I set the custom template tosearch-filter-results.php
and all works 🙂Let me know.
Anonymous(Private) December 17, 2014 at 11:25 am #9201Hello,
Thank you for your answer.
I don´t find any “query_posts” in my search.php file.
This is my search.php file:
<?php get_header(); ?>
<?php
if($data[‘blog_full_width’]) {
$content_css = ‘width:100%’;
$sidebar_css = ‘display:none’;
$content_class= ‘full-width’;
} elseif($data[‘blog_sidebar_position’] == ‘Left’) {
$content_css = ‘float:right;’;
$sidebar_css = ‘float:left;’;
} elseif($data[‘blog_sidebar_position’] == ‘Right’) {
$content_css = ‘float:left;’;
$sidebar_css = ‘float:right;’;
}
?>
<div id=”content” class=”<?php echo $content_class; ?>” style=”<?php echo $content_css; ?>”>
<div class=”search-page-search-form”>
<h2><?php echo __(‘Need a new search?’, ‘Avada’); ?></h2>
<p><?php echo __(‘If you didn\’t find what you were looking for, try a new search!’, ‘Avada’); ?></p>
<form id=”searchform” class=”seach-form” role=”search” method=”get” action=”<?php echo home_url( ‘/’ ); ?>”>
<input type=”text” value=”” name=”s” id=”s” placeholder=”<?php _e( ‘Search …’, ‘Avada’ ); ?>”/>
<input type=”submit” id=”searchsubmit” value=”” />
</form>
</div>
<?php
if($data[‘search_results_per_page’]) {
$page_num = $paged;
if ($pagenum=”) { $pagenum = 1; }
global $query_string;
} ?>
<?php if (have_posts()) : ?>
<?php while(have_posts()): the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(‘post’); ?>>
<?php
if(‘page’ != $post->post_type && !$data[‘search_featured_images’]):
if($data[‘legacy_posts_slideshow’]) {
get_template_part(‘legacy-slideshow’);
} else {
get_template_part(‘new-slideshow’);
}
endif;
?>
<h2 class=”entry-title”>“><?php the_title(); ?></h2>
<?php if(!$data[‘search_excerpt’]): ?>
<div class=”post-content”>
<?php
$stripped_content = tf_content( $data[‘excerpt_length_blog’], $data[‘strip_html_excerpt’] );
echo $stripped_content;
?>
</div>
<?php endif; ?>
<?php if($data[‘post_meta’]): ?>
<div class=”meta-info”>
<div class=”alignleft vcard”>
<?php if(!$data[‘post_meta_author’]): ?><?php echo __(‘By’, ‘Avada’); ?> <span class=”fn”><?php the_author_posts_link(); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$data[‘post_meta_date’]): ?><span class=”updated”><?php the_time($data[‘date_format’]); ?></span><span class=”sep”>|</span><?php endif; ?><?php if(!$data[‘post_meta_cats’]): ?><?php the_category(‘, ‘); ?><span class=”sep”>|</span><?php endif; ?><?php if(!$data[‘post_meta_comments’]): ?><?php comments_popup_link(__(‘0 Comments’, ‘Avada’), __(‘1 Comment’, ‘Avada’), ‘% ‘.__(‘Comments’, ‘Avada’)); ?><span class=”sep”>|</span><?php endif; ?>
</div>
<div class=”alignright”>
<?php if(!$data[‘post_meta_read’]): ?>” class=”read-more”><?php echo __(‘Read More’, ‘Avada’); ?><?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php themefusion_pagination($pages = ”, $range = 2); ?>
<?php else: ?>
<div class=”post-content”>
<div class=”title”>
<h2><?php echo __(‘Couldn\’t find what you\’re looking for!’, ‘Avada’); ?></h2><div class=”title-sep-container”><div class=”title-sep”></div></div>
</div>
<div class=”error_page”>
<div class=”one_third”>
<h1 class=”oops <?php echo ($sidebar_css != ‘display:none’) ? ‘sidebar-oops’ : ”; ?>”><?php echo __(‘Oops!’, ‘Avada’); ?></h1></div>
<div class=”one_third useful_links”>
<h3><?php echo __(‘Here are some useful links:’, ‘Avada’); ?></h3>
<?php $iconcolor = strtolower($data[‘checklist_icons_color’]); ?><style type=’text/css’>
.post-content #checklist-1 li:before{color:<?php echo $iconcolor; ?> !important;}
.rtl .post-content #checklist-1 li:after{color:<?php echo $iconcolor; ?> !important;}
</style><?php wp_nav_menu(array(‘theme_location’ => ‘404_pages’, ‘depth’ => 1, ‘container’ => false, ‘menu_id’ => ‘checklist-1’, ‘menu_class’ => ‘list-icon circle-yes list-icon-arrow’)); ?>
</div>
<div class=”one_third last”>
<h3><?php echo __(‘Try again!’, ‘Avada’); ?></h3>
<p><?php echo __(‘If you want to rephrase your query, here is your chance:’, ‘Avada’); ?></p>
<?php get_search_form(); ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div id=”sidebar” style=”<?php echo $sidebar_css; ?>”>
<?php
if (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Search Sidebar’)):
endif;
?>
</div>
<?php get_footer(); ?>Thank you very much for your help.
Best regards…
Anonymous(Private) December 18, 2014 at 11:31 pm #9283*Ross means the search.php in avada folder!!!
I had the same problem with Avada theme. I got to the line Ross is reffering and i just used a // before query_posts. I still have one major problem. when i use search for anything else than product_cat or product_tag the results (products) are displayed like blog posts. Any suggestions on that Ross would be really helpful since i am coder.Anonymous(Private) December 18, 2014 at 11:42 pm #9284Uhh i forgot to ask one more question Ross since you know Avada’s things. I tried anything(or almost) but nothing works…. what are the settings for content selector, pagination selector and the template for Avada???? Hope you have a solution! You ‘ll be my hero!!!
Whatever the answer is thanks for the great support till now.Cheers
Ross Moderator(Private) December 21, 2014 at 3:41 pm #9368Hey Chris
You content selector will depend on your template…
First upgrade S&F to latest version (out today)
Then in S&F admin – go to “display results” and select “as archive”…
Then scroll down, you will see
use custom template
.. here enter “search.php” or the filename of your template (it is recommended you duplicate this template and rename it to leave other search in your site in tact)…This template now defines how your results look – once you have followed these steps, do you still see your results displaying in different ways?
Thanks
Anonymous(Private) April 9, 2015 at 9:55 pm #14820I have purchased the Pro version and also use the Avada theme. Maybe a silly question, but how do you make a copy of a template? I used the editor from the dashboard and found the right template (in my case search.php). But what steps to take to copy this template and give it a new name?
Just a newbe looking for help.
Thanks
MarcRoss Moderator(Private) April 13, 2015 at 7:19 pm #14989Hi marc
In your theme folder you need to duplicate the template.
If you develop locally, its as simple as copying and pasting the file, if your only online, then you you need to use either the theme editor (I never use this, not sure if there is copy functionality), or probably your best bet, access your site via FTP, then you can upload/download files.
Thanks
Anonymous(Private) February 12, 2018 at 4:15 pm #159121Avada has changed since these post.
Can someone tell me what parts to remove in this default Avada search.php file.
<?php
/**
* Template for search results.
*
* @package Avada
* @subpackage Templates
*/// Do not allow directly accessing this file.
if ( ! defined( ‘ABSPATH’ ) ) {
exit( ‘Direct script access denied.’ );
}
?>
<?php get_header(); ?>
<section id=”content” <?php Avada()->layout->add_class( ‘content_class’ ); ?> <?php Avada()->layout->add_style( ‘content_style’ ); ?>>
<?php if ( have_posts() && 0 != strlen( trim( get_search_query() ) ) ) : ?><?php if ( ‘bottom’ == Avada()->settings->get( ‘search_new_search_position’ ) ) : ?>
<?php get_template_part( ‘templates/blog’, ‘layout’ ); ?>
<div class=”fusion-clearfix”></div>
<?php endif; ?><?php if ( ‘hidden’ != Avada()->settings->get( ‘search_new_search_position’ ) ) : ?>
<div class=”search-page-search-form search-page-search-form-<?php echo esc_attr( Avada()->settings->get( ‘search_new_search_position’ ) ); ?>”>
<?php
/**
* Render the post title
*/
echo avada_render_post_title( 0, false, esc_html__( ‘Need a new search?’, ‘Avada’ ) ); // WPCS: XSS ok.
?>
<p><?php esc_html_e( ‘If you didn\’t find what you were looking for, try a new search!’, ‘Avada’ ); ?></p>
<form class=”searchform seach-form” role=”search” method=”get” action=”<?php echo esc_url_raw( home_url( ‘/’ ) ); ?>”>
<div class=”search-table”>
<div class=”search-field”>
<label class=”screen-reader-text” for=”searchform”><?php esc_attr_e( ‘Search for:’, ‘Avada’ ); ?></label>
<input id=”searchform” type=”text” value=”” name=”s” class=”s” placeholder=”<?php esc_html_e( ‘Search …’, ‘Avada’ ); ?>” required aria-required=”true” aria-label=”<?php esc_html_e( ‘Search …’, ‘Avada’ ); ?>”/>
</div>
<div class=”search-button”>
<input type=”submit” class=”searchsubmit” value=”” alt=”<?php esc_attr_e( ‘Search’, ‘Avada’ ); ?>” />
</div>
</div>
</form>
</div>
<?php endif; ?><?php if ( ‘top’ == Avada()->settings->get( ‘search_new_search_position’ ) || ‘hidden’ == Avada()->settings->get( ‘search_new_search_position’ ) ) : ?>
<?php get_template_part( ‘templates/blog’, ‘layout’ ); ?>
<?php endif; ?><?php else : ?>
<div class=”post-content”>
<?php Avada()->template->title_template( esc_html__( ‘Couldn\’t find what you\’re looking for!’, ‘Avada’ ) ); ?>
<div class=”error-page”>
<div class=”fusion-columns fusion-columns-3″>
<div class=”fusion-column col-lg-4 col-md-4 col-sm-4″>
<h1 class=”oops”><?php esc_html_e( ‘Oops!’, ‘Avada’ ); ?></h1>
</div>
<div class=”fusion-column col-lg-4 col-md-4 col-sm-4 useful-links”>
<h3><?php esc_html_e( ‘Helpful Links:’, ‘Avada’ ); ?></h3>
<?php $circle_class = ( Avada()->settings->get( ‘checklist_circle’ ) ) ? ‘circle-yes’ : ‘circle-no’; ?>
<?php
wp_nav_menu(
array(
‘theme_location’ => ‘404_pages’,
‘depth’ => 1,
‘container’ => false,
‘menu_class’ => ‘error-menu list-icon list-icon-arrow ‘ . $circle_class,
‘echo’ => 1,
‘item_spacing’ => ‘discard’,
)
);
?>
</div>
<div class=”fusion-column col-lg-4 col-md-4 col-sm-4″>
<h3><?php esc_html_e( ‘Try again’, ‘Avada’ ); ?></h3>
<p><?php esc_html_e( ‘If you want to rephrase your query, here is your chance:’, ‘Avada’ ); ?></p>
<?php echo get_search_form( false ); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</section>
<?php do_action( ‘avada_after_content’ ); ?>
<?php
get_footer();/* Omit closing PHP tag to avoid “Headers already sent” issues. */
Trevor(Private) February 12, 2018 at 4:34 pm #159138It has changed a lot. With Avada, it is necessary to use the Shortcode Display Results method now, and the edit, modify and style the results.php to meet your needs, or use a page builder to make a page, one that is supported by Search & Filter, as the CodeCanyon Page Builder plugin from WPBakery is.
-
AuthorPosts