Hey 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 it search-filter-results.php
, on around line 71
there is a query_posts
– I simply remove this line – then in S&F settings, I set the custom template to search-filter-results.php
and all works ๐
Let me know.
AnonymousInactive
Thank you Gregory and Russ. I created the new directory and copied the results.php file to the folder. Once I did that, I expected to find the new template file displayed in my WP control panel, under Search & Filter (such that I could edit in the UI), but I’m not seeing it. Do I have to edit the results.php file directly, in order to configure how my search/filter results are rendered on the page?
Thanks,
Tim
AnonymousInactive
I’m just a user (not Ross), but from http://www.designsandcode.com/wordpress-plugins/search-filter-pro/docs/
If you wish to customise the display of your results, a template file is included in the Search & Filter folder.
1) Create a folder in your theme folder called search-filter.
2) Copy the file wp-content\plugins\search-filter\templates\results.php from the templates folder in to your newly created folder wp-content\themes\your-theme-name-\search-filter\results.php
Search & Filter will now use this template to display your results ๐
I had to dig into php code to make it render the way I wanted it. I just found the template that renedered my posts originally, and replace the section in results.php with that one.
AnonymousInactive
Hi Guys,
I Just bought the plugin so i’m trying to find my way.
I used this in my code: <?php echo do_shortcode('[searchandfilter id="881"]'); ?>
which is the ID from the form I’ve made.
I also created a folder in my theme called search-filter
with the file results.php
Unfortunately when I press submit on my form nothing happens.
Any idea what i’m doing wrong?
Thanks,
Sam
AnonymousInactive
Hi Ross,
Thanks for your help so far!
I haven’t managed to get the formatting working yet. Here’s what’s inside my search.php file:
$post_type = get_query_var( ‘post_type’ );
if ( ‘download’ == $post_type )
locate_template( array( ‘archive-download.php’ ), true );
else
locate_template( array( ‘index.php’ ), true );
It doesn’t work when I copy it into the results.php file. Same funny-looking layout. I’ve spent five hours fiddling with code today but no luck yet ๐
Hey Tom
Thanks for the info, RE the checkbox filter – I’ve just noticed this is a bug – because you are not using permalinks and using Post Id the plugin has an error – I will test and fix this soon.
RE the layout
Customising your results is a little out of scope of support of the plugin but I’ll try to help point in the right direction:
First you must copy over the template files to your theme, as per these instructions:
http://www.designsandcode.com/wordpress-plugins/search-filter-pro/docs/#docs-new-ajax
Once you have done that we can begin customising your results..
For all templates you will find a while
loop – this is how it loops through your posts and displays your pages and results.
So to copy the style of your search results page to this one, I would take a look at the template for displaying your search results (probably search.php
), and find the while
loop.
Then open results.php
– the template you copied over from the instructions, and you will also see a while
loop. Although the loops are a little different, you should be able to copy over the HTML from search.php
to results.php
.
This is the basic approach to copying over the layout from these files ๐
Hope that helps!
AnonymousInactive
Hi Ross,
Sorry, I didn’t notice you’d responded, it didn’t notify me with an email.
Anyway, thanks, I solved problem #2: I found that it was because of a plugin that prevented access to the ajax.php page. I replaced the plugin with another one, and it looks like it’s working now.
Any advice on how I should go about modifying results.php?
Thanks a lot! ๐
AnonymousInactive
Thanks Ross!
Didnt see the update, but will be watching for it. I now have Ajax working well on this page:
http://www.mysurfflicks.com/browse-all-surf-films/
I am working on the custom results.php now and that is also coming along well. I created 2 searches, one with Ajax, one without. The non-ajax search is used throughout the site in widgeted areas. Once I am able to enable Ajax from widgeted areas, this site will be a very powerful engine thanks to this plugin! Looking forward to the update ๐
My home page also has the search widgeted using Genesis Framework. Once this update is released, how do you think I should handle the results from the homepage? Should I redirect to another page or customize the homepage to display the results?
AnonymousInactive
Can I add to the lopp in my results.php file? Do you have any suggestions for this implementation?
http://codex.wordpress.org/Class_Reference/WP_Query
<?php
while ($query->have_posts())
{
$query->the_post();
?>
AnonymousInactive
Hi,
I would like the pagination to look like the rest of my site. I am using Ajax results with a custom template and the pagination is used from the results.php template, not my theme. I see you have nice looking pagination that comes from your theme in your demo: http://demo.designsandcode.com/sfpro-movie-reviews/video-demo/
How can I use this with Ajax and results as shortcode? Your help is appreciated.