Advertisement
nicolaslagios

IF MENU PLUGIN, EXTRA FUNCTION FOR WOOCOMMERCE PRODUCT CATEG

Apr 24th, 2019
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement