• Resolved bnfw

    (@voltronik)


    Hi,

    I’m using this plugin to place an image field on the a custom taxonomy called ‘base_location’.

    I’m then looping through all of the taxonomies and pulling the images along with them.
    Here’s my code:

    <?php 
    
    	// List of Provinces
    	$provinces = get_terms( 'base_location', array( 'parent' => 0 ));
    
    	echo '<div id="where-to-go-provinces" class="clearfix">';
    
    		foreach ($provinces as $province) {
    
    			// Get custom field image for each term
    			$cat_image = get_category_meta('image', $province); ?>
    
    			<div class="province threecol">
    		 		<a href="<?php echo get_term_link($province); ?>">
    		 			<?php echo wp_get_attachment_image($cat_image, 'place-thumbnail'); ?>
    		 			<?php echo '<h3>' . $province->name . '</h3>'; ?>
    		 		</a>
    			</div>
    		<?php }
    
    	echo '</div>';
    ?>

    The problem is, it’s only returning the image from the custom field for the very first foreach. After this, it doesn’t output anything.

    Here’s a screenshot to show what I mean: https://cl.ly/image/0X3b2f3f2h3o

    Do you know why this might be?

    https://www.ads-software.com/plugins/cfs-custom-category-fields/

Viewing 1 replies (of 1 total)
  • Plugin Author GatorDog

    (@gatordog)

    Thanks for the info. Yes, in the last rev, an update was added to remove a cfs hook so it did not effect any other cfs calls. However, it did not set an internal flag that keeps track of this. This bug has been fixed and it will work as expected for you in the latest version, 1.2.1. Thanks again for the bug report.

Viewing 1 replies (of 1 total)
  • The topic ‘Only outputting custom field in first foreach loop.’ is closed to new replies.