Exemplo n.º 1
0
 /**
  * Perform additional action registration
  *
  * This will replace WordPress' Custom Background with ours
  */
 public function onRegisterActions()
 {
     // Create an public instances
     $this->galleries = new Galleries($this);
     $this->images = new Images($this);
     // Register post types
     register_post_type(self::PT_GALLERY, array('labels' => array('name' => __('Background Image Sets', $this->getName()), 'singular_name' => __('Background Image Set', $this->getName())), 'public' => true, 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_in_nav_menus' => false, 'show_ui' => false, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title')));
     // Since 1.0.30 - Customize Theme screen for WP 3.4
     if (Helpers::checkWPVersion('3.4', '>=')) {
         $this->customizer = new \Myatu\WordPress\BackgroundManager\Customizer\Customizer($this);
     }
     // If we're performing an AJAX call, the other bits aren't required
     if (Helpers::DoingAjax()) {
         return;
     }
     add_action('admin_menu', array($this, 'onRemoveWPBackground'), 5, 0);
     add_action('wp_head', array($this, 'onWpHead'));
     add_action('get_edit_post_link', array($this, 'onGetEditPostLink'), 10, 3);
     add_action('add_attachment', array($this, 'onAddAttachment'), 20);
     // Adds 'Background Image' to Library
     add_action('edit_attachment', array($this, 'onAddAttachment'), 20);
     add_action('admin_bar_menu', array($this, 'onAdminBarMenu'), 90);
     add_filter('body_class', array($this, 'onBodyClass'), 20);
     // @see: onAddAttachment()
     add_theme_support('custom-background');
 }