Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 11 through 20 (of 1,224 total)
  • Author
    Search Results
  • #274289

    Trevor
    Participant

    Yes, just like that. Show him the results.php file from our plugin templates folder. I will leave this open unless you think I should close it?

    #274198

    Anonymous
    Inactive

    Hello Trevor,
    can you please confirm the following?

    1) I’ve created a custom results page with the ID (14) of the search form…
    wp-content\themes\my-child-theme-name\search-filter\14.php

    2) … I’ve put all the current php code, except:

    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }

    3) … in the section commented “// the current results.php code here”

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(14)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
    
      if ( $query->have_posts() )
    {
    	?>
    ...

    Is the above procedure correct?
    If I need to translate the website (using WPML), do I need to create a new search form and a new custom results page (so with another ID)?

    Thanks.

    #274170

    Trevor
    Participant

    Using the Shortcode method, you would need to edit the results.php file, as detailed in this post:

    https://support.searchandfilter.com/forums/topic/search-results-before-query-is-submitted/#post-273770

    You would need to follow our guide when doing that:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    #274060

    Trevor
    Participant

    In the Search & Filter plugin folder, in the subfolder named templates, are two files. Normal pagination template is results.php, and there is another for infinite scroll, with a similar but different structure.

    Which one did you use?

    Whichever one you used, I assume that you first followed our guide when doing that:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    The file must be renamed to either results.php or {the number of the form ID}.php

    What you should have done (and maybe did not) is to copy the results-infinite-scroll.php template file to your child theme search-filter folder, and then rename that copied file to results.php

    Then you would edit that file, making sure to keep the general structure and some of the classes intact. The key classes in that file are:

    search-filter-results-list
    search-filter-result-item

    Using ftp (or some file manager), rename the current results.php template file and bring over a copy of the infinite scroll default results file and rename that to results.php. It will not look so good, but it will take things back to basics to see where the issue/problem lies.

    If the correct number of posts now show, and infinite scroll works, then you will know that there is an error in your custom results.php code, so I would then need to asee a copy of that file.

    #273929

    Trevor
    Participant

    To test whether it worked, I used our Using a Shortcode display results method, following the guide here, and the customising section (so I had my own copy of the results.php file):

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    On each post for which there was a map needed, I made a map in wpgmaps and noted the ID.

    Using Advanced Custom Fields, I created a ‘map_id’ custom field for these posts, and then added against each post the relevant map ID. I also made a parent map, and noted that map ID.

    Before the while loop starts in the results.php template (‘the template’ from now on), I defined two variables:

    $post_content_output = '';
    $map_output = '[wpgmza id="2" mashup=true mashup_ids="';

    where 2 is the parent map ID (so change to suit).

    As each loop of while is run, you output the strings into $post_content_output and add the post map ID to $map_output, with a comma after each ID.

    When the loop has finished, you need to trim the last comma off $map_output, then add '" parent_id="2"]' to it. That should complete it as a mashup shortcode.

    Then you have two variables to echo to the page (one as a do_shortcode function).

    I no longer have a copy of the results.php I used, sorry, so you would need to code this yourself, but the logic is as above.

    This was the reference I used:

    https://www.wpgmaps.com/documentation/advanced-map-options/map-shortcode-parameters/

    #273770

    Trevor
    Participant

    Yes, you would need to edit the results.php file, as indicated here (changing the ID shown to match that of your form):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(6745)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // the current resuts.php code here (ALL the code from the if ( $query->have_posts() ) line and onwards)
    }
    #273715

    In reply to: Pagination problems


    Trevor
    Participant

    Are you able to send me a live link/URL to your search page so I can take a look?

    I am not sure why you are trying to combine the category template with our results.php template?

    The filter_next_query shortcode would normally be used only if the form is set to Custom display results method.

    #273663

    Anonymous
    Inactive

    Hi,

    I have a category template I am using with my shortcode <?php echo do_shortcode(‘[searchandfilter id=”3136″ action=”filter_next_query”]’)?>

    I have the standard WordPress pagination in the template – so at the moment the pagination does not work with the search results, it acts independently of the filter results.

    I don’t know how to combine the results.php with the category template to use the searchandfilter pagination.

    #273649

    Anonymous
    Inactive

    Of course I know the documentation and made safe changes to results.php before 🙂

    #273620

    Trevor
    Participant

    This is the guide to making ‘safe’ changes to our results.php template:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    Do you need to style the form itself? If you share with me a live link/URL to your search page so I can take a look, I might be able to give you some custom CSS, but you would need to show me, with one or more annotated screenshot(s), the design change(s) you want? If you can do that, you would need to upload the screenshot image(s) to a file sharing site (like the WordPress Cloudup site, Google Drive, Weshare, Dropbox etc.) and share the link with me?

Viewing 10 results - 11 through 20 (of 1,224 total)