/** * Return the tax_query for the specified post type * * @param string $post_type * @return array */ protected function get_tax_query($post_type) { $tax_query = array(); if ($post_type === 'post') { $category_ids = $this->get_the_category_ids(); if ($category_ids) { $tax_query[] = $this->get_tax_query_condition('category', $category_ids); } $tag_ids = $this->get_the_tag_ids(); if ($tag_ids) { $tax_query[] = $this->get_tax_query_condition('post_tag', $tag_ids); } return $tax_query; } if ($post_type) { $taxonomies = Habakiri::get_the_taxonomies(); foreach ($taxonomies as $taxonomy_name) { $term_ids = $this->get_the_term_ids($taxonomy_name); if ($term_ids) { $tax_query[] = $this->get_tax_query_condition($taxonomy_name, $term_ids); } } return $tax_query; } return $tax_query; }
/** * Return the taxonomies */ protected function taxonomies() { $taxonomies = Habakiri::get_the_taxonomies(); $taxonomy = ''; foreach ($taxonomies as $taxonomy_name) { $term_list = get_the_term_list(get_the_ID(), $taxonomy_name, '', ', ', ''); $taxonomy = sprintf('<li class="entry-meta__item %s">%s: %s</li>', esc_attr($taxonomy_name), esc_attr(get_taxonomy($taxonomy_name)->labels->name), $term_list); } }