Home Forums Front-end Issues Can't Get Taxonomy Image to Display Reply To: Can't Get Taxonomy Image to Display

  • I am also having the same issue, and have followed the logic on the link above. However, all of the images I need already exist in the Artists custom post type, and I don’t want to have to upload a new image to go with each Product Taxonomy. Each artist has a bio image and a banner image in their record. I need to associate the artist’s banner image with an item in the online store. It’s working, but it’s relying on a plugin that is no longer supported, so I want to get it to work using the existing images.

    Here is is the structure: I have a WooCommerce store with a taxonomy named product_artist. I have custom post types of Artists. Each artist has custom image fields: artist-bio & artist-banner. I need to display the artist-banner field on the WooCommerce template page. I have this code, but don’t know how to finish it, to display the image:

    /** Begin add artist banner to top of product page **/
    if(is_single()) {
    $terms = get_the_terms( $post->ID, ‘product_artist’ );
    if ( !empty( $terms ) ){
    // get the first term
    $term = array_shift( $terms );
    $artist = $term->slug;
    $short_url = get_site_url();
    $url = $short_url . ‘/artists/’ . $artist;
    $postid = url_to_postid( $url );
    $posttype = get_post_type($postid);

    I don’t know what to do from here to get the banner image to show on the page. This works, but the plugin used is outdated and we want to move away from it.
    // adds the banner image from Artist post associated with this single product displayed
    if (class_exists(‘MultiPostThumbnails’)
    && MultiPostThumbnails::has_post_thumbnail($posttype, ‘banner-image’, $postid)) :?>
    <?php MultiPostThumbnails::the_post_thumbnail($posttype, ‘banner-image’, $postid);?>

    <?php else : ?>
    <?php endif; /** end artist banner **/?>

    Thank you for any help you can give!