Support » Plugin: Taxonomy Images » image for list of terms of a taxo

  • Hi,

    I want to list the terms (with images of this plugin) of a specific taxonomy. How can i do ?

    I use this code

    $terms = get_terms( array(
        'taxonomy' => 'marque',
        'hide_empty' => false,
    ) );
    
    print_r($terms);

    it’s perfect but I don’t see the image in the output.
    How can I see the data of each image ?

Viewing 1 replies (of 1 total)
  • Hello, this example is in the doc of the plugin.

    Use this to retrieve the name, the link and the url of the image.

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array(
            'taxonomy'     => 'categorie_prodotti',
            ) );
            if ( ! empty( $terms ) ) {
                print '<div class="container" style="padding-top:50px;">';
                foreach ( (array) $terms as $term ) {
    
                print'<div class="listcategory" >';
                print'<div class="category-content" ><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '"><h2>'.$term->name.'</h2></div>';
                print'</a>';
                print '<div class="category-thumb">' . wp_get_attachment_image( $term->image_id, 'medium' ) . '</div>';
                print '<div class="cat-description">'.$term->description.'</div>';
                print '</div>';
                }
                print '</div>';
                
            }

    For more customization look into the README.md in the plugin folder.

    Best regards

    • This reply was modified 1 year, 10 months ago by  ilpert.
    • This reply was modified 1 year, 10 months ago by  ilpert.
Viewing 1 replies (of 1 total)
  • The topic ‘image for list of terms of a taxo’ is closed to new replies.