Skip Navigation

[Résolu] Change the taxonomy image size in a View

This support ticket is created Il y a 8 années et 5 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Marqué : 

This topic contains 3 réponses, has 2 voix.

Last updated by morktron Il y a 8 années et 5 mois.

Assisted by: Ivan.

Auteur
Publications
#348354

Hi, I am trying to: change the taxonomy image size in a View

I visited this URL: https://toolset.com/forums/topic/display-taxonomy-image-in-a-view/

Which is very helpful indeed - so now my taxonomy images are working within Views.

However the full size images are loading. Please let me know how to change the image size to something like 'medium'.

Many thanks

#348417

The spammers have responded to my post!

#348431

Ivan
Supporter

Languages: Anglais (English )

Hello,

Sorry for this, spam is removed and his account is blocked.

If you are using the same plugin for adding images to taxonomy, you can make a simple modification on the filter to change image size. For example:

function get_category_image($atts){
    $get_image = z_taxonomy_image_url($atts['term_id'], 'thumbnail');
    return $get_image;
}
add_shortcode( 'taxonomy-image', 'get_category_image' );

Available images sizes are: thumbnail, medium, large, or full. ("full" is default size.)

Also, if you want to define custom size, you can use array with two elements as size parameter, for example

function get_category_image($atts){
    $get_image = z_taxonomy_image_url($atts['term_id'], array(300, 250));
    return $get_image;
}
add_shortcode( 'taxonomy-image', 'get_category_image' );

Thanks, Ivan

#348688

Thanks Ivan! I've got is working now, you make it seem so easy 😉

My mistake was:

$atts['term_id' , 'thumbnail']

instead of

$atts['term_id'], 'thumbnail'

So close but yet so far! Thanks again

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.