Forums

Taxonomy Images
list taxonomy categries with Images (6 posts)

  1. ignitionmedia
    Member
    Posted 1 year ago #

    HI there, I've had a good look around and cant work out how to incorporate my taxonomy images provided by this plugin with my category list...

    eg;

    <?php
    //list terms in a given taxonomy using wp_list_categories  (also useful as a widget)
    $orderby = 'name';
    $show_count = 0; // 1 for yes, 0 for no
    $pad_counts = 0; // 1 for yes, 0 for no
    $hierarchical = 1; // 1 for yes, 0 for no
    $taxonomy = 'product_categories';
    $title = '';
    $depth = 1;
    
    $args = array(
      'orderby' => $orderby,
      'show_count' => $show_count,
      'pad_counts' => $pad_counts,
      'hierarchical' => $hierarchical,
      'taxonomy' => $taxonomy,
      'title_li' => $title,
      'depth'   => $depth
    );
    ?>
    <ul>
    <?php
    wp_list_categories($args);
    ?>
    </ul>

    It doesnt have to be a list, but I just want all my categories from the taxonomy 'product_categories' to displayed the category image & link through to the category.

    Can you please advise how that is done based on the above?

  2. ignitionmedia
    Member
    Posted 1 year ago #

    can anyone help me on this one?

  3. Michael Fields
    Theme Wrangler
    Posted 12 months ago #

    You'll need to upgrade to version 0.7 and then use code similar to the following:

    $terms = apply_filters( 'taxonomy-images-get-terms', '' );
    if ( ! empty( $terms ) ) {
        print '<ul>';
        foreach( (array) $terms as $term ) {
            print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
        }
        print '</ul>';
    }
  4. LindenWalsh
    Member
    Posted 12 months ago #

    I would really like to know how to achieve this also. I would like to be able to loop through categories and output the images and names of each in a list. And when I click through on one do the same for its child categories.

  5. isay
    Member
    Posted 8 months ago #

    Any inputs in looping through the categories and outputing the thumbnails.

    e.g. something similar to:

    foreach ($terms as $s => $term) {
         // Print the term image
         echo $term->name;
    }

    Chhers,
    Mike

  6. isay
    Member
    Posted 8 months ago #

    I need the above functionality in a plugin which lists sub-taxonomies..

    Thank you for help!

    //Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic