Forums Forums Search & Filter Pro I found a mistake?

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)