Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 421 through 430 (of 1,224 total)
  • Author
    Search Results
  • #192106

    In reply to: Search results


    Trevor
    Participant

    Line 42 of your custom results.php looks like this:

    <div class="blog-post__title"><a href="<?php the_permalink();?>"><?php the_title();?></a></div>

    It does not need the <a href="<?php the_permalink();?>"> and closing </a> as it is not a link, and you can replace the <?php the_title();?> with code to show what you want.

    This documentation is a start:

    https://searchandfilter.com/documentation/accessing-search-data/

    But you can use more complex code that the snippets shown.

    #191370

    Trevor
    Participant

    I cannot yet see anything obviously incorrect.

    If you create a test page and use the default results.php file, does the failure of Ajax also happen.

    Is it possible to test this also with a default theme? Whilst I cannot see any javascript errors, there might be a conflict with the theme and/or another plugin.

    Are you using any lazy load scripts (such as in Jetpack)?

    #191321

    Trevor
    Participant

    As you are using the Shortcode results method, and our results.php template file (infinite scroll version), 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).

    #191180

    Anonymous
    Inactive

    I would like the results of a term of this taxonomy to always be displayed when selecting a term from my own taxonomy.

    Example:
    Taxonomy: Regions
    Terms: Austria, Vienna, Salzuburg etc.
    Articles with the term “Austria” should always be displayed if one of the other terms is selected.

    For the taxonomy archive page I have added the following to the “functions.php”:

    function my_modify_main_query( $query ) {
    	if ( !is_admin() && $query->is_main_query() ) {
    		
    			$query->set( 'tax_query', array(
    				'relation' => 'OR',
    				array(
    					'taxonomy' => 'region',
    					'field' => 'slug',
    					'terms' => 'Österreich'
    				),
    			) );
    		
    	}
    }
    add_action( 'pre_get_posts', 'my_modify_main_query' );

    Unfortunately this does not affect the result of “Search & Filter”. I use the shortcode method for display and in the file “results.php” the element “$query” is actually addressed as well.

    Any approach on how to get my behavior realized?

    #191153

    Trevor
    Participant

    That data is outputted by our results.php template when using the Shortcode results display method:

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

    In that documentation you can find the Customising guide. In the standard results.php template file, this is the code that you are asking about:

    Found <?php echo $query->found_posts; ?> Results<br />
    Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />

    If you wish to change (or delete it), you can.


    Anonymous
    Inactive

    Hi Trevor,
    I’m using shortcodes and I can’t find the results.php file. I don’t have any p-content\plugins\search-filter\templates\results.php Actually I don’t have neither a “templates” folder.
    Which could be the problem?
    Thanks a lot and please let me know if you need further information

    #190610

    Trevor
    Participant

    Did you try this using our shortcode method? Your code from:

    <div class="row">
    	<div id="results">
    <?php if ( $query->have_posts() ) : ?>

    Could replace the code in our standard results.php, see here for customizing the results.php file:

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

    #190495

    Anonymous
    Inactive

    Perfect, that works. Thank you very much!

    For others, the answer was to add the following lines in the results.php, which adds a “not-sf-filtered” or “sf-filtered” class:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1075)->current_query();
    if (!$sf_current_query->is_filtered()) {
      $is_filtered = " not-sf-filtered";
    } else {
      $is_filtered = " sf-filtered";
    } ?>
    
    <div class="content-width<?php echo $is_filtered;?>">
    #190452

    Trevor
    Participant

    Rename the custom file for the arabic form, copy the default infinite scroll template from our plugin files, and rename that to results.php and see if the problem persists.

    #190436

    Anonymous
    Inactive

    yes i have custom results.php files

Viewing 10 results - 421 through 430 (of 1,224 total)