Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro duplicate results

Viewing 9 posts - 1 through 9 (of 9 total)
  • Sky Esser
    #260429

    Hi — any idea why I might be getting duplicate results on this page — http://12x.f4e.mwp.accessdomain.com/service/program-leaders/?_sft_grade=6-8&_sft_specialty=ela-general — The query in the url is a good example — I’m just testing with these three girls/posts, so far, and it looks like the results in the top section are correct, but I get the extra list of all three girls below that. This only seems to happen when Ajax is on — seems to work fine whit Ajax off.

    I am using a custom results.php in my child theme and some custom code from Enfold support to deal with a separate issue that was also only occurring with Ajax on. But I took everything from another site with the same setup where it all seems to be working fine (https://abodecommunities.org/services/property-management/properties/).

    Thanks so much!

    Trevor Moderator
    #260501

    There is a coding problem in the results.php template file, so I will need to see that file. You can post it here, but inside code ticks (one before the code, one after). On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:

    https://www.google.com/search?q=back+tick+code+key

    Sky Esser
    #260508

    Thanks so much!! I’m trying the code tick thing here, but here’s a link to the file, too, just in case: https://www.dropbox.com/s/lq01m81d0zc5qnt/results.php?dl=0 — Thanks again for the prompt reply and support!

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Results<br />
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div>			
    			<p><?php the_content(); ?><p>			
    		</div>
    		
    		<hr />
    		<?php
    	}
    	?>
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    ?>
    Trevor Moderator
    #260510
    This reply has been marked as private.
    Sky Esser
    #260517

    Darn. So, there’s that other code that Enfold support added to my child theme’s function.php file, to fix that other ajax issue I was having where, after the first query, listing would just show as blank (you could see the number of results was correct, but the post content wasn’t showing). That code is at the top of this functions file — https://www.dropbox.com/s/uxdi8wez6cc0grd/functions.php?dl=0 (also pasted below, do you have a preference?) — but again, that seems to be working ok on at https://abodecommunities.org/services/property-management/properties/. And then there’s the custom taxonomies I’m adding, starting after that Enfold fix — that’s different from the other site, where I’m not using custom taxonomies — maybe that could be the issue? Also, all three of these girls all work in all three grade levels — but that shouldn’t be a problem, should it? Thanks again so much for looking into this! But I’ll understand if this is going beyond the support you can provide.

    <?php
    
    /**
     * Allow to force execution of shortcodes e.g. for plugins who call shortcode via an ajax call.
     * Enfold uses this to execute the shortcode for modal popup preview in backend
     * 
     * @since 4.5.7.2
     * @param boolean
     * @param aviaShortcodeTemplate $obj_sc
     * @param array $atts
     * @param string $content
     * @param string $shortcodename
     * @param boolean $fake
     * @return boolean				true if sc should be executd regardless of page structure - same as popup preview
     */
    function my_custom_exec_sc_only( $exec_sc_only, $obj_sc, $atts, $content, $shortcodename, $fake )
    {
    	/**
    	 * Return if true - Enfold already requested an execution because of preview in backend
    	 * Otherwise this is likley to be false.
    	 */
    	if( true === $exec_sc_only )
    	{
    		return $exec_sc_only;
    	}
    	
    	/**
    	 * Make your checks here - make sure to return boolean true if you want to force execution
    	 * 
    	 * Following is an example to allow it for all ajax calls.
    	 */
    	if( defined( 'DOING_AJAX' ) && DOING_AJAX )
    	{
    			if(!is_admin() && is_page(1972)) 
    	{
        	return true;
    	} 
    	}
    	
    	return true;
    }
    
    add_filter( 'avf_alb_exec_sc_only', 'my_custom_exec_sc_only', 10, 6 );
    
    // ADD GRADE LEVELS TAXONOMY
     
    add_action( 'init', 'create_grade_nonhierarchical_taxonomy', 0 );
    function create_grade_nonhierarchical_taxonomy() {
      $labels = array(
        'name' => _x( 'Grade Levels', 'taxonomy general name' ),
        'singular_name' => _x( 'Grade Level', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Grade Levels' ),
        'popular_items' => __( 'Popular Grade Levels' ),
        'all_items' => __( 'All Grade Levels' ),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edit Grade Level' ), 
        'update_item' => __( 'Update Grade Level' ),
        'add_new_item' => __( 'Add New Grade Level' ),
        'new_item_name' => __( 'New Grade Level Name' ),
        'separate_items_with_commas' => __( 'Separate grade with commas' ),
        'add_or_remove_items' => __( 'Add or remove grade' ),
        'choose_from_most_used' => __( 'Choose from the most used grade' ),
        'menu_name' => __( 'Grade Levels' ),
      ); 
      register_taxonomy('grade','post',array(
        'hierarchical' => false,
        'labels' => $labels,
        'show_ui' => true,
        'show_admin_column' => true,
        'update_count_callback' => '_update_post_term_count',
        'query_var' => true,
        'rewrite' => array( 'slug' => 'grade' ),
    	'show_in_rest' => true,
      ));
    }
    
    // ADD SPECIALTIES TAXONOMY
     
    add_action( 'init', 'create_specialty_nonhierarchical_taxonomy', 0 );
    function create_specialty_nonhierarchical_taxonomy() {
      $labels = array(
        'name' => _x( 'Specialties', 'taxonomy general name' ),
        'singular_name' => _x( 'Specialty', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Specialties' ),
        'popular_items' => __( 'Popular Specialties' ),
        'all_items' => __( 'All Specialties' ),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edit Specialty' ), 
        'update_item' => __( 'Update Specialty' ),
        'add_new_item' => __( 'Add New Specialty' ),
        'new_item_name' => __( 'New Specialty Name' ),
        'separate_items_with_commas' => __( 'Separate specialty with commas' ),
        'add_or_remove_items' => __( 'Add or remove specialty' ),
        'choose_from_most_used' => __( 'Choose from the most used specialty' ),
        'menu_name' => __( 'Specialties' ),
      ); 
      register_taxonomy('specialty','post',array(
        'hierarchical' => false,
        'labels' => $labels,
        'show_ui' => true,
        'show_admin_column' => true,
        'update_count_callback' => '_update_post_term_count',
        'query_var' => true,
        'rewrite' => array( 'slug' => 'specialty' ),
    	'show_in_rest' => true,
      ));
    }
    Trevor Moderator
    #260799
    This reply has been marked as private.
    Sky Esser
    #260942

    Got it — I had the post content sitting in one of Enfold’s Color Section elements, so I could control the width, but apparently something about those color sections was triggering the duplicates. Sorry, I kind of thought of that, but I didn’t think it was likely, and I got lazy and didn’t test it before asking for your help. Thanks so much for getting me there — really appreciate it. Oh, and I had an ID set in the color section — so thanks for pointing out that issue, too. Thanks again, Trevor.

    Trevor Moderator
    #260944

    Great to hear you have it sorted. Is it OK to close this thread for now?

    Sky Esser
    #260952

    Yep, for sure. Thanks again!

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘duplicate results’ is closed to new replies.