term_id)) $qoString = $qo->taxonomy."##".$qo->term_id; else $qoString = "af_na"; ?> $pt, "posts_per_page" => $postPerPage, "tax_query" => array(), "orderby" => "title", "order" => "ASC", "post_status" => "publish" ); if(!$_POST){ $qo = get_queried_object(); //get the page's current taxonomy to filter if(isset($qo->term_id) && $useQO==true){ array_push($args['tax_query'], array( 'taxonomy' => $qo->taxonomy, 'field' => 'id', 'terms' => $qo->term_id ) ); } }else{ if($_POST['qo'] != 'af_na'){ $qo = explode('##',$_POST['qo']); array_push($args['tax_query'], array( 'taxonomy' => $qo[0], 'field' => 'id', 'terms' => $qo[1] ) ); } if(isset($_POST['paged'])) $args['paged'] = $_POST['paged']; } if(isset($_POST['paged'])) $args['paged'] = $_POST['paged']; else $args['paged'] = 1; if(isset($filters)){ //add all the filters to tax_query foreach($filters as $tax => $ids){ foreach($ids as $id){ array_push($args['tax_query'], array( 'taxonomy' => $tax, 'field' => 'id', 'terms' => $id ) ); } } } //inserts a relation if more than one array in the tax_query if(count($args['tax_query'])>1) $args['tax_query']['relation'] = 'AND'; if(file_exists(get_stylesheet_directory()."/ajax-loop.php")){ include get_stylesheet_directory()."/ajax-loop.php"; }else{ $i =0; $ajaxPostfilter = new WP_Query(); $ajaxPostfilter->query($args); if(in_array("top",$paginationDisplay)) $this->pageination($ajaxPostfilter->found_posts, $postPerPage); if($ajaxPostfilter->have_posts()): while ($ajaxPostfilter->have_posts()) : $ajaxPostfilter->the_post(); ?>

pageination($ajaxPostfilter->found_posts, $postPerPage); echo "

Total Results: {$ajaxPostfilter->found_posts}

"; if($_POST) die(); } function pageination($totalPosts,$postPerPage){?>