Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class WpImageFactory{
- const PLUGIN_SLUG = 'bawp_imagefactory';
- const POST_TYPES = array(self::PLUGIN_SLUG);
- public static function init(){
- return new self();
- }
- private function __construct() {
- add_action('admin_enqueue_scripts', array($this, 'enqueueAssets'));
- }
- public static function enqueueAssets($hook){
- global $post_type;
- if(in_array($post_type, self::POST_TYPES)){
- if(($hook == 'post.php' || $hook == 'edit.php' || $hook == 'post-new.php')) {
- wp_enqueue_media();
- wp_enqueue_script('bawp-imagefactory', plugin_dir_url(__FILE__).'assets/bawp-imagefactory.js', null, 0.1, true);
- wp_enqueue_style('bawp-imagefactory', plugin_dir_url(__FILE__).'assets/bawp-imagefactory.css', null, 0.1, 'all');
- }
- }
- }
- }
- add_action('init',array(WpImageFactory::class, 'init'));
Add Comment
Please, Sign In to add comment