Add Admin menus or submenus depending on conditions

I managed to find a solution: File 1: //Count the number of active plugins whose Author is “My Brand”, and store the number in a global variable. $GLOBALS[‘mybrand_active_plugins’]=0; if (!function_exists(‘get_plugins’)){require_once ABSPATH.’wp-admin/includes/plugin.php’;} $plugins=get_plugins(); $activated_plugins=get_option(‘active_plugins’); foreach ($activated_plugins as $p){ if( (isset($plugins[$p])) AND ($plugins[$p][‘Author’]==’My Brand’)){ $GLOBALS[‘mybrand_active_plugins’]++; } } // Add menus on sidebar if($GLOBALS[‘mybrand_active_plugins’]<2) { function sub1_setup_menu() { … Read more

Declaring a new woo commerce product type i get this error

According to the class definition the constructor expects to receive either a product ID (integer) or a product instance (object). This leads me to believe WooCommerce expects the product to already exist. https://docs.woothemes.com/wc-apidocs/class-WC_Product.html Despite expecting an integer or object it appears that you can still create a new instance by simply passing null. <?php $pjb … Read more