WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
help getting images. (1 post)

  1. cybershot
    Member
    Posted 1 year ago #

    I love this plugin. It is working perfectly. Problem is that I am having trouble getting the code in the documentation to work. I have even watched the tutorial video and the code in that doesn't work for me. I have been able to get the images out of this way

    $terms = apply_filters( 'taxonomy-images-get-terms', '' );
    if ( ! empty( $terms ) ) {
        foreach( (array) $terms as $term ) {
    	print  wp_get_attachment_image( $term->image_id, 'menu' );
    	}
    }

    My problem with this is that I can't figure out how to add my formatting so that I can get the image to display where I want it to. When I do get it to work, it returns 9 images when it should only return 3. I am trying to get this code to work in a custom loop for the categories.

    $allcats = get_categories('child_of='.get_query_var('cat')); 
    
        foreach ($allcats as $cat) :
        $args = array(
        'posts_per_page' => 3, // max number of post per category
    
        'category__in' => array($cat->term_id)
        );
    
        $customInCatQuery = new WP_Query($args); 
    
        if ($customInCatQuery->have_posts()) :
        echo '<div class="menupageContent">';
    THIS IS WHERE I NEED THE IMAGES TO SHOW. ONE IN EACH OF THE MENUPAGECONTENT DIVS. 
    
    	echo apply_filters( 'taxonomy-images-queried-term-image', 'menu' );
        echo '<h3>'.$cat->name.'</h3>';
        echo '<ul>';
        while ($customInCatQuery->have_posts()) : $customInCatQuery->the_post(); ?>
    
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    
    <?php
    endwhile;
    echo '</ul></div><!--end menupageContent-->';
    ?>

    http://wordpress.org/extend/plugins/taxonomy-images/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic