The category images plugin you are using will provide you template tags which you can then use in the plugin’s code.
Thread Starter
snecz
(@snecz)
Thanks.
Which code should I use?
To resize category image simply add the size as a second parameter, for example:
if in category or taxonomy template:
<img src="<?php echo z_taxonomy_image_url(NULL, 'thumbnail'); ?>" />
or if inside a loop:
<ul>
<?php foreach (get_the_terms(get_the_ID(), 'your_taxonomy') as $cat) : ?>
<li>
<img src="<?php echo z_taxonomy_image_url($cat->term_id, 'medium'); ?>" />
<a href="<?php echo get_term_link($cat->term_id, 'your_taxonomy'); ?>"><?php echo $cat->name; ?></a>
</li>
<?php endforeach; ?>
</ul>
I’m trying to put it just after:
<h2 class="menu-type"><?php echo $menu_type->name; ?></h2>
Is that right?
yes sounds about right but since we are already looping through menu types so you would could use $menu_type->term_id
Thread Starter
snecz
(@snecz)
Wow, thanks a lot. It’s working now 🙂
<h2 class="menu-type"><?php echo $menu_type->name; ?></h2>
<img src="<?php echo z_taxonomy_image_url($menu_type->term_id, 'thumbnail'); ?>" />
But it doesnt’t look nice. I’d like the image would be under menu item in the same tab… Where should I change the code?
you can use CSS to adjust that.
Thread Starter
snecz
(@snecz)
You’re right. Thanks a lot 🙂