PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

RFC: new taxonomy images filter

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

To use the taxonomy image feature we have to set term images within the filter even though these may have already been set on the taxonomy. To avoid this, can you add a filter that allows us to override the default image selection and provide an image from the term meta? Just a couple of lines needed in ext/image/view/woof.php e.g.

$term_key = 'images_term_' . $term['term_id'];
$images = isset($woof_settings[$term_key]) ? $woof_settings[$term_key] : array();

$image = '';
// AL: Override image
if (empty($image = apply_filters('woof_taxonomy_image', $image, $term))) {
   if (isset($images['image_url']) AND ! empty($images['image_url']))
   {
      $image = $images['image_url'];
   } else
   {
      continue;
   }

   if ($images['image_url'] == 'hide')
   {
      continue;
   }
}

Then for our custom taxonomy:

add_filter('woof_taxonomy_image', 'motor_make_image_filter', 10, 2);
function motor_make_image_filter($image, $term) {
   if ($term['taxonomy'] ==="product_brands") {
      $image = get_field('make_logo', $term['taxonomy'].'_'.$term['term_id']);
   }
   return $image;
}

Technically no reason to include $image in the filter as done here, but you might want to place the filter after the check if images have been set in the filter settings.

Thanks

P.S. Filter came bundled with theme but happy to go pro if it helps!

Hello

Ok!  Thank you  for  cooperation

I passed it to the developers