Forums › Forums › Search & Filter Pro › Archive Results / Shortcode results how the hell does this work?
- This topic has 10 replies, 2 voices, and was last updated 8 years, 10 months ago by Anonymous.
-
Anonymous(Private) January 19, 2016 at 2:26 pm #34683
So, it seems Archive results (atleast if using AJAX) is not as simple as taking the WORKING contents of a modded template file and dropping it into the theme folder then changing to custom Archive and referencing that file?
Is there a reason for this?
What am I missing?
I guess its easy enough to use the template in the plugin folder, but how about allowing me to have the template in my theme folder and maybe using the shortcodes ref number to link to that template file?
This would allow me to have a different template and also (maybe more importantly) an easy place for the template file in my theme so I dont have to hunt around for it.
It this possible please?
If not can you clearly state exactly who I turn a working template file which Ive altered to an archive file? Im using ajax so it replaces a DIV on the page.
Ross Moderator(Private) January 19, 2016 at 3:04 pm #34693Hey Matthew
You can create custom templates for each method no worries.
Might be an obvious question, but did you read the overview and comparison of the two methods in the docs?
http://www.designsandcode.com/documentation/search-filter-pro/search-results/#Shortcode_vs_Archive
Thanks
Ross Moderator(Private) January 19, 2016 at 3:12 pm #34700So if you are using archive method you can specify any template in your theme to use.
So, as an example, in yoru theme, duplicate
search.php
and call itsearch-filter.php
.Then, in S&F admin, under “display results”, select “as archive” as the display results method.
Then, make sure “use custom template” is ticked, and in teh filename, simply enter “search-filter.php”.
Underneath this, you will find an option to add a slug.
Enter “search-filter” (this can be anything you wish).
Now you can go to
yoursite.com/search-filter
– and you will find a search results page, using the templatesearch-filter.php
you have just created.You will probably want to add the S&F form to this page, so you this may require some customisation of the file
search-filter.php
Does that make sense?
Thanks
Anonymous(Private) January 19, 2016 at 3:16 pm #34709So….
Shortcode works
` <div class=”row” id=”searchbar” >
<div class=”col-lg-12″>
<div class=”row search-section”>
<div class=”container”><?php echo do_shortcode(‘[searchandfilter id=”111777″]’); ?>
</div><div>
<div id=”wpas-debug”></div>
<div id=”wpas-results”><?php echo do_shortcode(‘[searchandfilter id=”111777″ show=”results”]’); ?>
</div> <!– This is where our results will be loaded –>
</div>
</div>
</div>
</div>`Then if I replace the second shortcode PHP line with anything… it doesnt work, if its the loop from the usual WP search etc then its empty. If I use the supplied template then I get
Fatal error: Call to a member function have_posts() on a non-object in /path to/page-used-boats.php on line 109Walk me slowly?
Anonymous(Private) January 19, 2016 at 3:20 pm #34713The instructions dont mention how you put in the search UX controls and doesnt really explain much so far as I can tell.
I did assume that “Enter the filename of the custom template: ” should be the URL of the template that goes within the search results DIV, but clearly thats not true, its the whole page (in my case a custom page in WP).
Anonymous(Private) January 19, 2016 at 3:30 pm #34720Ah so Ive just seen its possible
Yep, it’s actually pretty easy to do also……
Create a folder IN your WP Theme folder and name it /search-filter
Then start with any template (e.g. results.php) and name it for the search filter you’ve created. For example, in your search and filter shortcode, it gives you a form ID, such as “102”, so name your template page “102.php” and put it in that new folder and upload it.
S&P will use your new template file to display your results.
Ross Moderator(Private) January 19, 2016 at 4:13 pm #34734Hey Matthew glad you got it working!
Yeah the info on the shortcdoe method is here:
The docs do need some improvement though that is true – I’m in the process of setting up a new site for S&F and in this transition I will be reviewing and adding to the docs.
Feedback like this is always helpful so thanks for that 🙂
-
AuthorPosts