Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Created December 29, 2020 11:35
Show Gist options
  • Save reachkamrul/95c39ff3956c3906c53e70ac60c5c8af to your computer and use it in GitHub Desktop.
Save reachkamrul/95c39ff3956c3906c53e70ac60c5c8af to your computer and use it in GitHub Desktop.
/**
* Woocommerce/post category
*/
/* Custom Editor SmartCode
* {my_product_cat}
*/
add_filter('fluentform_editor_shortcode_callback_my_product_cat', function ($val) {
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ($terms as $term ) {
$product_cat_name = $term->name;
break;
}
return $product_cat_name . ' ';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment