SHARE
TWEET

IF MENU PLUGIN, EXTRA FUNCTION FOR WOOCOMMERCE PRODUCT CATEG

nicolaslagios Apr 24th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('if_menu_conditions', 'my_new_menu_conditions');
  2.  
  3. function my_new_menu_conditions($conditions) {
  4.   $conditions[] = array(
  5.     'id'        =>  'bagdome',                       // unique ID for the rule
  6.     'name'      =>  __('Ean Bagdome.gr'),    // name of the rule
  7.     'condition' =>  function($item) {                                   // callback - must return Boolean
  8.       return in_category('bagdome-gr') || is_product_category('bagdome-gr') || (is_product() && has_term('bagdome-gr', 'product_cat'));
  9.     }
  10.   );
  11.  
  12.   return $conditions;
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top