Thanks for the plugin, it was exactly what I was looking for !
No Problem! I really wanted it for my site too! Glad you like it.
I’d like to show the image within single.php. I guess I should also be able to choose which taxonomy is involved…
If you are using version 0.3 you should be able to use the get_image_html() method to display images in single views. It takes two arguments: the first is the size of the image and the second is the term_taxonomy_id of the image. Please bear in mind that this is different than the term_id.
To return the image link:
$my_var = $taxonomy_images_plugin->get_image_html( 'detail', $c->term_taxonomy_id );
To print the image link:
$taxonomy_images_plugin->print_image_html( 'detail', $c->term_taxonomy_id );
Hope this helps,
-Mike
Thank you for your quick answer !
I don’t know where I can find the term_taxonomy_id. I tried with the slug of the taxonomy but as you said, it doesn’t work… Could you tell me how to find it ?
Thanks ! π
You can try this loop:
$cats = get_categories();
foreach ( $cats as $c ) {
$url = get_category_link( $c->term_id );
$img = $taxonomy_images_plugin->get_image_html( 'detail', $c->term_taxonomy_id );
if( !empty( $img ) )
print '<a href="' . $url . '">' . $img . '</a>';
}
If you want to use a different taxonomy, you can replace get_categories() with get_object_terms(). Something like this may work:
$object_terms = wp_get_object_terms( $post->ID, 'fish' );
Did this work for you nicolinuxfr?
Ive used the shortcode via the do_action() function. When using this in taxonomy.php template page the thumbs appear absolutely fine. But ive the same code in a page template file, menu.php and the thumbnails dont show up.
Im using the following code to display the thumbnails
<div class="taxonomy">
<ul>
<?php $args = array('taxonomy' => 'sections'); ?>
<?php $tax_menu_items = get_categories( $args );
foreach ( $tax_menu_items as $tax_menu_item ):?>
<li>
<?php if (is_page()){?>
<?php do_action('taxonomy_image_plugin', 'fullsize'); ?>
<?php } else {?>
<?php do_action('taxonomy_image_plugin_print_image_html', 'fullsize'); ?>
<?php } ?>
<h3><a href="<?php echo get_term_link($tax_menu_item, $tax_menu_item->taxonomy); ?>">
<?php echo $tax_menu_item->name; ?>
</a></h3>
<p> <?php echo $tax_menu_item->description; ?></p>
</li>
<?php endforeach; ?>
</ul>
</div>
@umarglobal
<?php do_action( 'taxonomy_image_plugin_print_image_html', 'detail' ); ?>
is only meant to be used in taxonomy template. If I remember correctly, it is not meant to be used in single posts or pages. Try this instead:
<?php do_shortcode( '[taxonomy_image_plugin]' ); ?>
More information here:
http://ww.wp.xz.cn/extend/plugins/taxonomy-images/
Hi Micheal
Thanks for the prompt response π
I have used the shortcode within the menu page in wp-admin as
[taxonomy_image_plugin taxonomy="sections"]
and everything works fantastically.
However I want the tags to be displayed not within the post but in a particular position which i can on achieve by hard coding it in the template file menu.php where the menu page is using that template. Ive used the following code for this and nothing comes up
<?php do_shortcode( '[taxonomy_image_plugin taxonomy="sections"]'); ?>
Is this a bug or am i doing something wrong. BTW fantastic plugin
Thanks
Umar
Thanks! Does the menu page have any sections associated with it?
No not at all its just a standard wordpress page.
Confusing thing is that it appears fine when using the short code in wp-admin but when hardcoding it in the template file “menu.php” nothing shows
Maybe a very slight modification will do the trick:
<?php print do_shortcode( '[taxonomy_image_plugin]'); ?>
π
That worked just fine π
Your so helpful.. Thank you. Great plugin