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.
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.
+ “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>';
}
?>
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 🙂