The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Taxonomy Images
Use Taxonomy Image On single.php (1 post)

  1. martiniboy
    Posted 4 years ago #

    I am trying to associate an image to each term as a background image using an inline style, on the taxonomy.php it is no problem because I can use $image_url = apply_filters( 'taxonomy-images-queried-term-image-url', '', array('image_size' => 'full')
    But on the single.php I am struggling to just call the url of the image, I am able to add the image associated on the page with

    <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
    	<?php $cats = $object_terms = wp_get_object_terms( $post->ID, 'producttype' );
    foreach ( $cats as $c ) {
        $url = get_category_link( $c->term_id );
        $img = $taxonomy_images_plugin->get_image_html( 'full', $c->term_taxonomy_id );
        if( !empty( $img ) ) ?><?php echo $img ?><?Php }?>'

    but I only need the image url not the <img src="" etc./>

    I am thinking that I need alter get_image_html to get_image_url or someting similar but am struggling to find any literature about this.

    Any help would be appreciated


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Taxonomy Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic