I found a mistake?

Forums › Forums › Search & Filter Pro › I found a mistake?

  • This topic has 3 replies, 2 voices, and was last updated 11 years ago by Anonymous.
Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #26636

    Options: Include or Exclude results with specific tags, categories and taxonomy terms.
    if i use include category “52”, Auto Count does not work properly.

    http://www.mega-pools.ru/wp-content/uploads/2015/10/test.jpg

    Ross Moderator
    #26644

    Hmm I just tested on mine local version and it seemed ok – but it certainly looks wrong.

    It seems like perhaps something is modifying the count queries that are being peformed – are you using pre_get_posts anywhere?

    Can you try again with other plugins disabled?

    Thanks

    Anonymous
    #26653
    add_action( 'pre_get_posts', 'et_custom_posts_per_page' );
    function et_custom_posts_per_page( $query ) {
    	global $shortname;
    	
    	if ( is_admin() ) return $query;
    	
    	if ( $query->is_category ) {
    		$query->set( 'posts_per_page', get_option( $shortname . '_catnum_posts' ) );
    	} elseif ( $query->is_tag ) {
    		$query->set( 'posts_per_page', get_option( $shortname . '_tagnum_posts' ) );
    	} elseif ( $query->is_search ) {
    		if ( isset($_GET['et_searchform_submit']) ) {			
    			$postTypes = array();
    			if ( !isset($_GET['et-inc-posts']) && !isset($_GET['et-inc-pages']) ) $postTypes = array('post');
    			if ( isset($_GET['et-inc-pages']) ) $postTypes = array('page');
    			if ( isset($_GET['et-inc-posts']) ) $postTypes[] = 'post';
    			$query->set( 'post_type', $postTypes );
    			
    			if ( isset( $_GET['et-month-choice'] ) && $_GET['et-month-choice'] != 'no-choice' ) {
    				$et_year = substr($_GET['et-month-choice'],0,4);
    				$et_month = substr($_GET['et-month-choice'], 4, strlen($_GET['et-month-choice'])-4);
    
    				$query->set( 'year', absint($et_year) );
    				$query->set( 'monthnum', absint($et_month) );
    			}
    			
    			if ( isset( $_GET['et-cat'] ) && $_GET['et-cat'] != 0 )
    				$query->set( 'cat', absint($_GET['et-cat']) );
    		}
    		$query->set( 'posts_per_page', get_option( $shortname . '_searchnum_posts' ) );
    	} elseif ( $query->is_archive ) {
    		$query->set( 'posts_per_page', get_option( $shortname . '_archivenum_posts' ) );
    	}
    
    	return $query;
    }
    
    Anonymous
    #26654

    I removed from the template code. Now everything is working properly.

Viewing 4 posts – 1 through 4 (of 4 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.