/** * Will add a term filter to the query string of every link * * @since 2.5 */ protected function addTermFilterQueryVars() { $query = array(); // First create a map of taxonomy => terms foreach ($this->config->post_term as $term_id) { $term = $this->plugin->getTerm($term_id); $taxonomy = $this->plugin->getTaxonomy($term->taxonomy); if ($taxonomy->query_var) { if (!isset($query[$taxonomy->query_var])) { $query[$taxonomy->query_var] = array(); } $query[$taxonomy->query_var][] = $term->slug; } } if (!$query) { return; } // Construct query string $queryString = array(); foreach ($query as $var => $termSlugs) { $queryString[] = $var . '=' . join(',', $termSlugs); } $queryString = join('&', $queryString); foreach ($this->terms as $term) { $term->link .= strpos($term->link, '?') === false ? '?' : '&'; $term->link .= $queryString; } }