• Hey,
    I have this problem.
    Cant get the get_wp_term_image function to work with term-id in order to show the image. what can be the problem?

    also cant echo data from inside the condition function_exists condition
    This is my code

    								<li>
    									<?php
    									$term_list = wp_get_post_terms($post->ID, 'blog_theme', array("fields" => "all"));
    									//print_r($term_list);
    
    									   if (function_exists('get_wp_term_image'))
    									{
    										
    									    $meta_image = get_wp_term_image($term_list[0]->term_id); //It will give category/term image url 
    
    									}
    									echo '<div  align="center" width="24px"><img class="cat-img" src="' . $meta_image . '" alt="' . $meta_image . '" ></div>';?>
    								</li>
    								<li><?php echo $term_list[0]->name; ?></li>	
    							</ul>
    • This topic was modified 7 years, 10 months ago by davsev.
Viewing 1 replies (of 1 total)
  • Plugin Author Aftab Husain

    (@amu02aftab)

    Hi,

    Thanks for choosing my plugin.
    You have written right code. If you are

    There is only condition in the function, be sure you are passing category ID/ term Id ($term_list[0]->term_id) for which you have added image in back end.

    
    $meta_image = get_wp_term_image($term_list[0]->term_id);
    

    Please check and let us know if any issue.

    I am here if still any issue.

    Thanks,
    Aftab

Viewing 1 replies (of 1 total)
  • The topic ‘Cant get the get_wp_term_image function to work with term-id’ is closed to new replies.