Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 491 through 500 (of 1,224 total)
  • Author
    Search Results
  • #182020

    Anonymous
    Inactive

    Yes Trevor, I have copied the file. But I have no idea how to start customizing the CSS on the results page since there are no element IDs from what I could see. How can I go about coding for this? Do you have any sample code for results.php that I could start with?

    #182014

    Trevor
    Participant

    You would need to be using our Shortcode Display results method, and have followed the guide to customising:

    https://support.searchandfilter.com/documentation/search-filter-pro/search-results/using-a-shortcode/

    Once you have a copy of the results.php file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):

    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 {
      // the results.php PHP code here
    }

    Make sure you change the ID number in that snippet to the ID number of your form.


    Anonymous
    Inactive

    Hi Trevor,

    I hope you’ve been keeping well. I’m trying to implement your plugin on another site. This time I need to do a simple search. I’m using the custom method and with action=”filter_next_query”.

    I want to hide the search results before a query is made. I followed your previous method and modified the results.php but that works only for shortcode method. Can we do the same for custom method?


    Trevor
    Participant

    I see that this is set to Shortcode Display results method and uses Infinite scroll. Did you customise the results.php file and if so, what are the contents of that file (if you post the contents here, use code back ticks – one before and one after the code)?

    #181690

    Trevor
    Participant

    Hi

    Sorry I was out of the office on Friday so I am catching up over the weekend. You need to have followed the ‘Customising the Results’ on this documentation page.

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

    In the results.php file is this line:

    <p><br /><?php the_excerpt(); ?></p>
    

    The excerpt strips all formatting away. The only way to keep links, formatting etc. is to replace that code with something like this:

    <div class="entry-content"><?php the_content();?></div>
    
    #181556

    In reply to: Custom Template


    Trevor
    Participant

    It might be easier to use our Shortcode Display results method, copy the results.php file as instructed to your child theme folder, find the bit in that code that matches your ‘while’ loop and replace our code with yours (not all of yours will be needed):

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

    #181449

    Anonymous
    Inactive

    I found documentation that says to copy the contents of wp-content\plugins\search-filter\templates\results.php and paste to wp-content\themes\search-filter/results.php and make customizations there. However, I do not see a file named results.php, nor is there a folder named templates. Please help.

    #181077

    Trevor
    Participant

    Do NOT delete that old version from WordPress, as it will delete the forms (the latest version does not do that).

    Did you edit any of the files (like the results.php template file)? If so, you need a copy of that.

    Use ftp to delete the folder, then go to plugins and add the new version and activate it.


    Trevor
    Participant

    In the results.php template file, what happens if you comment out or remove lines 162 to 165:

    function shorten_image_title( $title, $settings ){
    
    	return substr( $title, 0, (int)$settings['archive_title_length'] );
    }

    OR, change the function name (also twice in the code above), to sf_shorten_image_title?

    If this function is used also by your theme, that may be the conflict.

    #180803

    Trevor
    Participant

    Hi

    If you followed that guide, you will have a copy of our results.php file in your child theme folder (in a sub-folder named search-filter).

    Yes you can edit the file. It follows the WP Codex standard for making an archive page. Most likely your theme archive.php file will look similar, and it is the section inside the while loop that you shoudl focus on. It is quite likely that your theme code can be transplanted here, but it may require some modification to get it to work, depending on how closely your theme also follows the same WordPress Codex standards.

    We don’t have a guide as to how to do this, as every case would be very different.

Viewing 10 results - 491 through 500 (of 1,224 total)