-
Search Results
-
I need to remove the ?sf_action=get_data&sf_data=all&sf_paged=2 from my page urls.
I am loading search results via Ajax and infinite scroll. When the infinite scroll is triggered, all posts that are loaded have that query string appended—this is breaking critical redirects.
How do I prevent this from happening?
I have already added this function to my functions.php
function _remove_script_version( $src ){
$parts = explode( ‘?’, $src );
return $parts[0];
}
add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );
add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );I inherited this site from another developer and do not usually work in wordpress or php.
2 scenarios:
#1: Infinite scroll container is specified: results will quickly load (as many as I specify per page,) it will hit the infinite scroll trigger at the bottom, trigger loading icon, and then nothing more comes back.
#2: No infinite scroll container is specified: Infinite scroll will load all results at the normal rate per page ie) 7 results per page, but the trigger happens at almost every scroll, even when I’m scrolling toward the top of the page. I think it may be a problem with how the containers are specified and maybe a naming conflict. I’ve tried many different values for offset but it doesn’t seem to make a difference. I saw others requesting a ‘load more results’ button and wondered if that was possible yet?
I’m also open to trying it with pagination, but when I try to implement, it seems like its trying to do some string parsing with the url which initially does not have a query string so I get
cannot read property split() of undefined. thanks so much for your insight!Here are the two files this is happening in:
<?php /** * The template used for displaying page content for the Big Green Database * * @package red_underscores */ // Determine which resource page this is $page_id = get_the_ID(); $page_name = ''; if ( $page_id == 12614) { $page_name = 'garden'; // Your Edible School Garden (cat = garden-skills-resources) $lessons_id = 12612; $sf_form_id = 14035; } if ( $page_id == 12612 ) { $page_name = 'lessons'; // Garden Lessons + Curriculum (cat = curriculum-lessons-activities) $garden_id = 12614; $sf_form_id = 14036; } ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php $featured = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); $overlay_background = "linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0))"; ?> <div class="featured main" style="background: <?php echo $overlay_background ?>, url('<?php echo $featured[0] ?>'); min-height: 720px;"> <div class="grid-container featured-content"> <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> </div> </div><!-- featured --> <div class="grid-container"> <div class="entry-content grid-60 prefix-20 tablet-grid-90 tablet-prefix-5"> <?php the_content(); ?> </div><!-- .entry-content --> </div> <?php // Toggle between pages ?> <div class="grid-container"> <?php ?> </div> <?php // Display at most three highlighted resources from this main category $main_resource_category = ''; switch ($page_name) { case 'lessons': $main_resource_category = 'curriculum-lessons-activities'; break; case 'garden': $main_resource_category = 'garden-skills-resources'; break; } $args = array( 'post_type' => 'resource', 'posts_per_page' => 3, 'tax_query' => array( array( 'taxonomy' => 'resource-category', 'field' => 'slug', 'terms' => $main_resource_category ) ), ); // Display remaining results (not highlighted) via search & filter ?> <div class="sf-results-container"> <div class="grid-container"> <?php echo do_shortcode( '[searchandfilter id="'.$sf_form_id.'"]' ); ?> </div> <div class="dotted-border"></div> <div class="grid-container grid-of-posts resources"> <div class="grid-33 push-66 sf-pop-sidebar"> <h3>Popular Collections:</h3> <div class="dotted-border"></div> <div id="popular-collections-remote-control"></div> </div> <div class="grid-66 pull-33 two-col-results search-filter-results-list"> <?php echo do_shortcode( '[searchandfilter id="'.$sf_form_id.'" show="results"]' ); ?> </div> <div class="pagination"> Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <?php wp_pagenavi(); ?> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> </div> </div> </div> <script> (function($) { // Load again after ajax to work after filtering results $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ // Place search and filter boxes within grid $("li.sf-field-post-meta-resource_subjects, li.sf-field-taxonomy-grade-level, li.sf-field-search, li.sf-field-taxonomy-resource-category, li.sf-field-post-meta-content_source, li.sf-field-post-meta-grade_level_range, li.sf-field-submit").addClass('grid-33 tablet-grid-50 mobile-grid-100'); }); $(document).ready(function() { // Get list of labels and inputs in .sf-field-post-meta-popular_collection_tag var labels = $('.sf-field-post-meta-popular_collection').find('label'); var inputs = $('.sf-field-post-meta-popular_collection').find('input'); // Append them to the #popular-collections-remote-control div for ( var i = 0; i < labels.length; i++ ) { var selectedClass = ''; // Apply selected class to anything that's selected on load if(inputs[i].checked) { selectedClass = 'selected'; } $('#popular-collections-remote-control') .append( '<div class="target '+ selectedClass +'" id="' + inputs[i].value + '">' + labels[ i ].innerHTML + '</div><div class="dotted-border"></div>'); } // Set up remote control clicks $('#popular-collections-remote-control .target').click(function() { var targetValue = $(this).attr('id'); $(this).toggleClass('selected'); $(':checkbox[value=' + targetValue + ']').trigger('click'); }); // Place search and filter boxes within grid $("li.sf-field-post-meta-resource_subjects, li.sf-field-taxonomy-grade-level, li.sf-field-search, li.sf-field-taxonomy-resource-category, li.sf-field-post-meta-content_source, li.sf-field-post-meta-grade_level_range, li.sf-field-submit").addClass('grid-33 tablet-grid-50 mobile-grid-100'); }); })(jQuery); </script> <footer class="entry-footer"> <?php //edit_post_link( esc_html__( 'Edit', 'red_underscores' ), '<span class="edit-link">', '</span>' ); ?> </footer><!-- .entry-footer --> </article><!-- #post-## --><?php /** * Search & Filter Pro * * Template for Filter Resources - Garden * */ if ( $query->have_posts() ) { ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="search-filter-result-item grid-50 tablet-grid-50 mobile-grid-100"> <?php get_template_part( 'template-parts/content', 'resource_overview' ); ?></div><?php } ?> <?php } else { ?> <div class='search-filter-results-list end-of-results' data-search-filter-action='infinite-scroll-end'> <p>no more results</p> </div> <?php } ?>I’m building a site with events as a custom post type. For the archive page, I’d like to just have three buttons (or radio buttons that I can style) with “All”, “Upcoming”, and “Previous Events.” How can I get this to work using S&F Pro? I was able to do this with pure code, but could never get the pagination correct. Any help is appreciated.
Topic: Style en result search
Hi, I’ve been trying to apply the style to a result for two days and I can not. I tried FTP in the search-filter folder, but I can not get it out like the videos that appear on the main page, can you help me? I do not know what to do and I’ve tried everything.
I use constructor diviHey Trevor,
I’m trying to add style=”display: none;” to this line of code:
<ul data-operator=”and” class=””>
I cannot find which file to make this edit in the Search and Filter plugin. It would be greatly appreciated if you could tell me which line and which file to edit.
Cheerss,
GaryI am having a searchbox in my website’s home page. When a user searches for any keyword then it shows the resultant articles with “Read More Articles” button as a pagination. I am using search.php file to display this result.
Q.1. Now I want to have additional filters like Searchbox and Dropdown with “Relevance” and “Date” sort order. How can I set this two dropdown with search field in my existing search result page along with same pagination style “Read More Articles” on the same page?
Q.2. I installed the Relevanssi Plugin and done the settings. Also enable the Relevanssi checkbox and Sort Results By relevance checkboxes under the Search Form->Advanced tab but When I try to search any keyword then I am not getting any result and previously I got the search results. What should be the issue? Am I doing something wrong?
Related to another support question I posted, I’m passing a WP_Query object from Search and Filter Pro to another plugin (Geomashup) in order to display search results on a map.
It works on initial page load, but when attempting to update the results via AJAX, the following appears:

… and so on, ad infinitum, evidently some kind of loop where an HTML container gets repeatedly written inside of itself. Inspecting the HTML, it appears that some characters (double quotes, backslashes) are being doubled and/or escaped like so:
<iframe name=”\"gm-map-1\"” src=”\"https:\/\/website.com\/?geo_mashup_content=render-map&map_data_key=6669c66d9609d8f9a1821e6928f3c584&map_content=global&show_future=1&name=gm-map-1&object_ids=174371529565047,174371529565046,174371529663274,174371529663195,174371529609792,174371529596380,174371529596379,174371529609791,174371529596378,174371529538729,174371529610349,174371529538728,174371529610348,174371529538726,174371529538724,174371529610352,174371529561088,174371529561087,174371529561086,174371529633478&sfid=174371529654519&sf_action=get_data&sf_data=results&_sf_s=some_keyword&post_date=12022018\\\\\\\\\\\\\\\\"\\\\"\"” style=”\"position:” absolute;=”” top:=”” 0;=”” left:=”” width:=”” 100%;=”” height:=”” border:=”” none;=”” overflow:=”” hidden;\”=””><\/iframe><\/div><\/div>”}</iframe>
I’ve tried things like json_decode() and stripslashes() on the results before displaying, but it is clear there is an error that I cannot identify, and I cannot tell if Search and Filter is involved. Would you be able to suggest troubleshooting advice?
hi,
first thanks a lot for your help recently, now everything looks nearly optimal.
but the first row of the drop down menu makes issues.
http://alpoh.dev-inmotto.de/unternehmen/
i believe i didn´t find the right css class, could you tell me what´s the case?

best regards, sandra