Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Redocneves

    (@redocneves)

    I have found the Problem. The Problem was with AutoLink from TaxoPress

    Thread Starter Redocneves

    (@redocneves)

    Now Code Works like:

    header.php:

    <?php if(is_single()): $mainheadbar_img = taxonomy_images_plugin_single_src() ?>
    <?php else: $mainheadbar_img = apply_filters( 'taxonomy-images-queried-term-image-url', '', array('image_size' => 'full') );endif; ?>

    functions.php

    function taxonomy_images_plugin_single_src( $default, $args = array() ) {
    	$filter = 'taxonomy-images-list-the-terms';
    	if ( current_filter() !== $filter ) {
    		taxonomy_image_plugin_please_use_filter( __FUNCTION__, $filter );
    	}
    
    	$args['having_images'] = true;
    
    	if ( ! taxonomy_image_plugin_check_taxonomy( 'category', $filter ) ) {
    		return '';
    	}
    
    	$terms = apply_filters( 'taxonomy-images-get-the-terms', '', $args );
    
    	if ( empty( $terms ) ) {
    		return '';
    	}
    
    	$output = '';
    	foreach( $terms as $term ) {
    		if ( ! isset( $term->image_id ) ) {
    			continue;
    		}
    		$image_attributes = wp_get_attachment_image_src( $term->image_id, $args['image_size'] );
        $image_src = $image_attributes[0];
        break;
    	}
    
    	if ( ! empty( $image_src ) ) {
    		return $image_src;
    	}
    	return '';
    }

Viewing 2 replies - 1 through 2 (of 2 total)