This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Help with showing correct posts on load

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Help with showing correct posts on load Reply To: Help with showing correct posts on load

#27870
Ernest MarcinkoErnest Marcinko
Keymaster

Oh, I see what you mean now.

The only way to do that is via custom coding. The filter value needs to be conditionally set via the API.

Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter('asp_pre_get_front_filters', 'asp_change_tax_filter', 10, 2);
function asp_change_tax_filter($filters, $type) {
  $taxonomies = 'qld_regions'; // Comma separated list of taxonomies

  // --- DO NOT CHANGE ANYTHING BELOW ---
  if ( is_archive() ) {
      $taxonomies = explode(',', $taxonomies);
      foreach ( $taxonomies as $taxonomy ) {
          $taxonomy = trim($taxonomy);
          foreach ($filters as $k => &$filter) {
              $term_id = get_queried_object()->term_id;
              if ($type == 'taxonomy' && $filter->data['taxonomy'] == $taxonomy) {
                  $filter->unselect();
                  $filter->select($term_id);
              }
          }
      }
  }
  return $filters;
}

Unfortunately I cannot guarantee that this is going to work at all, but it should be a good start.