How to get category image custom post type taxonomy in wordpress?

I have a custom post estate_property and its has taxonomies property_category ,propert_action.I have installed WPCustom Category Image to upload image for each category of taxonomies. How to display the uploaded image .I search for it but failed to display image
My code is

$taxonomy_name="property_category";
$asd=get_the_terms($post->ID, $taxonomy_name); 
var_dump($asd); 

it returns nothing .Help please

3 Answers
3

From the details page of the WPCustom Category Image Plug-in : https://wordpress.org/support/plugin/wpcustom-category-image

1st – Go to Wp-Admin -> Posts(or post type) -> Categories (or taxonomy) to see Custom Category Image options.

2nd …depending on whether you want to show a single category image or display several in a loop –

//SINGLE

echo do_shortcode('[wp_custom_image_category onlysrc="https://wordpress.org/plugins/wpcustom-category-image/false" size="full" term_id="123" alt="alt :)"]');

//LOOP

foreach( get_categories(['hide_empty' => false]) as $category) {
    echo $category->name . '<br>';
    echo do_shortcode(sprintf('[wp_custom_image_category term_id="%s"]',$category->term_id));
}

In addition there is an example category template here –

https://gist.github.com/eduardostuart/b88d6845a1afb78c296c

Leave a Comment