• Resolved Cibulka

    (@cibulka)


    Hi, quick question about the awesome plugin TAXONOMY IMAGES: http://wordpress.org/extend/plugins/taxonomy-images/

    It basically enables to upload image assigned to a custom taxonomy tag in nice user interface.

    THE QUESTION: Is it possible to list EVERY tag from given taxonomy with its name, description and (of course) the image?

    I’m using the functionality do display sponsors of the project, so besides the text about them I need to display their logo as well.

    Thanks for great plugin and cheers from Prague! C.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Cibulka

    (@cibulka)

    BTW: I know there is a lot of workarounds (such as use “custom fields” for custom taxonomies: http://en.bainternet.info/2011/custom-taxonomies-extra-fields). Due to a nice user interface of the plugin, I prefer to stick with TAXONOMY IMAGES.

    Thanks!

    When you add the following line to a theme file:

    $terms = apply_filters( ‘taxonomy-images-get-terms’, ” );

    You will get an array of term objects. You can then loop over each object and print the needed data to the screen. Please see the “Working with all terms of a given taxonomy” section in http://wordpress.org/extend/plugins/taxonomy-images/ for a full list of modifiers that you can use.

    There is another plugin in the works to make this easier, but it is not fully tested yet.

    Thread Starter Cibulka

    (@cibulka)

    Hello Michael, thank you for the quickest reply!

    However I am getting still confused – after following the plugin instructions and using this code inside my “index.php” template –

    <?php
    	$terms = apply_filters( 'taxonomy-images-get-terms', 'sponzori' );
    	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>';
    	} else { echo'nothing'; }
    ?>

    – I am getting “nothing”. I am sure that it is obvious what I’m doing wrong but since I am no PHPer, I still do not follow. 🙂 Where should I specify the name or ID of the custonomy I want to retrieve?

    Or is the plugin meant to work just on custom taxonomy archive pages?

    Thank you, C.

    Thread Starter Cibulka

    (@cibulka)

    + “sponzori” is the name of my custom taxonomy

    Maybe something like this (untested):

    <?php
    	$terms = apply_filters( 'taxonomy-images-get-terms', null, array(
    		'taxonomy' => 'sponzori',
    	) );
    	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>';
    	}
    ?>
    Thread Starter Cibulka

    (@cibulka)

    WORKS!

    I just needed to change two bits:

    <?php
    	$terms = apply_filters( 'taxonomy-images-get-terms', null, array(
    		'taxonomy' => 'sponzori',
    	) );
    	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' ) . '</a></li>';
    		} print '</ul>';
    	}
    ?>

    1) 2nd print command: end of anchor tag (</a></li>)
    2) (before) 3rd print command: extra “}“.

    Michael, thank you very much!

    Nice! Glad to hear that … sorry for posting buggy code 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Taxonomy Images] – Custom taxonomy cloud containing images’ is closed to new replies.