Get taxonomy url, name, post count & image

I'm attempting to display a specific taxonomy (channel) in the archive.php page. I want to display the taxonomy's URL, name, post count, and taxonomy image.

This is what I have that's working so far:

?php
$taxonomy = 'channel';
$tax_terms = get_terms($taxonomy);
$image_url = print apply_filters( 'taxonomy-images-queried-term-image', '' );
?

ul
    ?php
    foreach ($tax_terms as $tax_term) { ?

        li
            ?php echo esc_attr(get_term_link($tax_term, $taxonomy)); ?
            ?php echo $tax_term-name; ?
            ?php echo $tax_term-count; ?            
            ?php echo $image_url-image_id; ?
        /li
    ?php } ?
/ul

I've gotten URL, name and post count working, the part that's not working is the taxonomy image provided by the Taxonomy Images plugin. (in the snippet, it's $image_url)

https://wordpress.org/plugins/taxonomy-images/

The plugin provides a image_id for an image added to a taxonomy, the plugin has a ton of ways to get the ID and display the image but I just can't seem to find the correct combination to work with my snippet with my level of skill.

Need some help, thanks.

Topic advanced-taxonomy-queries terms taxonomy images Wordpress

Category Web


Figured out a better option.

Instead of using Taxonomy Images plugin, Instead, I opted to use the more widely used Categories Images plugin.

https://wordpress.org/plugins/categories-images/

The working code below:

<?php
$taxonomy = 'channel';
$tax_terms = get_terms($taxonomy);

foreach ($tax_terms as $tax_term) { ?>

    <div class="column">
        <?php echo esc_attr(get_term_link($tax_term, $taxonomy)); ?>
        <?php echo $tax_term->name; ?>
        <?php echo $tax_term->count; ?>             
        <?php echo z_taxonomy_image_url($tax_term->term_id); ?>
    </div>
<?php } ?>

Don´t know how this plugin works in detail but i would try this:

<?php
$taxonomy = 'channel';
$tax_terms = get_terms($taxonomy);
?>

    <ul>
    <?php
    foreach ($tax_terms as $tax_term) { ?>

        <li>
            <?php echo esc_attr(get_term_link($tax_term, $taxonomy)); ?>
            <?php echo $tax_term->name; ?>
            <?php echo $tax_term->count; ?>             
            <?php print apply_filters( 'taxonomy-images-queried-term-image', '' ); ?>
        </li>
    <?php } ?>
</ul>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.