Answers for "get list of taxonomies wordpress"

PHP
0

Get taxonomies

$index_query = new WP_Query(array('post_type' => 'company', 'posts_per_page' => '-1', 'order' => 'DESC'));

while ($index_query->have_posts()) : $index_query->the_post();

    $taxonomy_ar = get_the_terms($post->ID, 'tax-name');

    $output = '<span class="btn">';
    foreach($taxonomy_ar as $taxonomy_term) {
        $output .= '<a href="'.get_term_link($taxonomy_term->slug, 'title').'">'.$taxonomy_term->name.' <span class="label">'.$taxonomy_term->count.'</span></a> ';
    }
    $output .= '</span>';

    echo $output;

endwhile;​
Posted by: Guest on September-26-2021

Code answers related to "get list of taxonomies wordpress"

Browse Popular Code Answers by Language