/** * Add metaboxes to WPI pages * @param type $screens */ function add_metaboxes($screens) { foreach ($screens as $screen) { if (!class_exists($screen)) { continue; } $location_prefixes = array('side_', 'normal_', 'advanced_'); foreach (get_class_methods($screen) as $box) { //** Set context and priority if specified for box */ $context = 'normal'; if (strpos($box, "side_") === 0) { $context = 'side'; } if (strpos($box, "advanced_") === 0) { $context = 'advanced'; } //** Get name from slug */ $label = WPI_Functions::slug_to_label(str_replace($location_prefixes, '', $box)); add_meta_box($box, $label, array($screen, $box), $screen, $context, 'high'); } } }