Search Results for 'results.php'

Forums › Forums › Search › Search Results for 'results.php'

Viewing 10 results – 591 through 600 (of 1,344 total)
  • Author
    Search Results

  • Anonymous
    Inactive

    Hi there –
    Many thanks again for your help yesterday. Following this great success, I felt a bit adventurous today and started setting things up for a different template to be used for another search form, following your guidelines (https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results).

    I created a php file (blogs.php) with the exact same content as the results.php file, and put it into the search-filter folder in my child theme. I created a new form and have added the shortcodes ([searchandfilter id=”8959″] and [searchandfilter id=”8959″ show=”blogs”]) to my testpage (cusp.ac.uk/testneu).

    Problem: It doesn’t seem to recognise my blogs.php file, and only displays my results when changing ‘show=”blogs”‘ to ‘show=”results”‘.

    Question: Is there a form setting I am missing? I.e. Do I need to set it up somewhere in the form itself? (Side info: Whenever I try to manually change it in the shortcodes window (right side of the form set-up), it goes back to the ‘show=”results”‘.

    With kind regards –
    Linda

    #176626

    Trevor
    Participant

    As you are if you are using our shortcode display results method (and therefore our results.php template file), it needs to be edited to look like this:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }

    Change 1024 to the ID number of your form (from the form shortcode).

    Make sure you are working on a copy of the results.php file in a search-filter sub-folder of your theme/child theme folder, and not the original in our plugin template folder.


    Anonymous
    Inactive

    It’s absolutely a great plugin, hands down. 🙂

    However, I want to customize something to fit my website theme.
    1. The search form layout:
    – Change the background color of the Reset button and Submit button.
    – Put the Reset button and Submit button on the same row.
    – Set all Dropdown controls the same size (or specific size).

    2. The search results layout:
    I use “Shortcode” for “Display results method” option. I don’t use “As an Archive” for “Display results method” option because I want my search results to show on a particular page with a specific sidebar, different from the other pages.

    I add Search & Filter Form Widget to sidebar and the search results will show on a specific page, which has the shortcode [searchandfilter id=”217″ show=”results”].
    Everything is OK but I want the search results layout be the same with my website theme. I use SociallyViral by mythemeshop, which has a grid layout with 2 columns per row.
    – Default Search & Filter Pro search results layout
    Default Search & Filter Pro search results layout
    – My Theme Search Results Layout
    My Theme Search Results Layout

    I copied the file wp-content\plugins\search-filter\templates\results.php from the templates folder into the folder in my theme (wp-content\themes\your-theme-name\search-filter\results.php). I tried several times to edit the results.php file to make the layout look like search.php file but failed! :<

    So, please help my to customize the search results layout.
    Here is the file search.php of my theme: search.php

    Thank you very much. I look forward to hearing from you.

    #176563

    Trevor
    Participant

    You would need to customise the results.php file to make HTML that would achieve the columns. This is the documentation you need to start with:

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

    You might other pages in your theme where you could copy HTML from.

    #176368

    Trevor
    Participant

    Hi

    I do not think you followed the instructions that I gave you in this reply:

    https://support.searchandfilter.com/forums/topic/posts-display-only-with-the-featured-image/#post-176289

    As I cannot see the search-filter folder nor the copy results.php file. I can do it for you, but it would mean (temporarily) adding a plugin (which you can remove if you don’t want to keep it)?


    Trevor
    Participant

    This would depend on the layout template being used for your page. That would depend on your theme or page builder/content plugin that you are using, or, if you are using our shortcode display results method and our results.php template file, it would look like this:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }

    Change 1024 to the ID number of your form (from the form shortcode).

    #176289

    Trevor
    Participant

    Hi

    The standard grids in Themify will not allow our plugin to filter their content, so the solution is to use the Shortcode method, which is what you have done. Then, it is necessary to modify the standard results.php template file from our plugin to meet your needs. The documentation for this is here:

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

    With the copy of results.php in your child theme folder (in the search-filter sub-folder), that file can now safely be edited.

    Do you have an example page, elsewhere in your site, of what the page grid would need to look like already made in Themify, as I could use that to suggest what edits to the HTML and PHP are needed?


    Trevor
    Participant

    It does indeed make sense. Here is how you would code what you want to do:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }

    Change 1024 to the ID number of your form (from the form shortcode).


    Anonymous
    Inactive

    I have a form with Relevanssi active, displaying results using a shortcode, with a custom results.php template in my theme. It all works great, except that the initial view of the page shows the “No results found…” text from the “else” part of my if ( $query->have_posts() ) code.

    That’s not a great place to start for people coming to the search page who have not searched for anything yet. I would love to be able to customize my results in this case better.

    1. Is there any way, in a newly arrived or reset results page, where there are no ?_sf_s=asdf style parameters in the url at all, I can instead show all possible results? Like an unfiltered listing of the post types included in the search form.

    2. If that’s not possible, can I least customize the returned text to be different than if no results are found? Something equivalent to elseif (~nothing-searched-yet no-parameters-in-URL~) { echo "Let's get started!"; } else { echo "No result found."; }

    Does that make sense? Thanks for your help!

    #175765

    Anonymous
    Inactive

    Hi agent,

    I’ve got a question. We’re using the shortcode show=”results” to display the results. We also fiddled with the results.php to match the outcome with our liking.

    I would like to know if it’s possible to show the results at random instead of showing it by date. Especially the results before you filter. I would like them to be random.

    Is that possible?

    Kind regards,

Viewing 10 results – 591 through 600 (of 1,344 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.