Forums Forums Search & Filter Pro Archive Results / Shortcode results how the hell does this work?

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #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
    #34693

    Hey 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

    Anonymous
    #34698

    I did read it yeah, Im clearly missing something basic about how to use an archive.
    So how would I use a different template file? And put it in the them folder?

    Ross Moderator
    #34700

    So 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 it search-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 template search-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
    #34709

    So….

    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 109

    Walk me slowly?

    Anonymous
    #34713

    The 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
    #34715

    Im honestly happy to use short code and the template as it works. Id just really prefer to have the template file in my theme folder.

    I see I can just rename to the ID for a custom result – now how about putting it in my template directory?

    Anonymous
    #34720

    Ah 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.

    Anonymous
    #34721

    FANTASTIC!!!!

    Should add this to the docs tbh.

    Maybe clear up how archives works with an example file too?

    Ross Moderator
    #34734

    Hey Matthew glad you got it working!

    Yeah the info on the shortcdoe method is here:

    http://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    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 🙂

Viewing 10 posts - 1 through 10 (of 11 total)