Beispiel #1
0
 public function init()
 {
     $name = $this->name;
     $args = $this->args;
     $wp_args = $this->parse_args($name, $args);
     register_post_type($name, $wp_args);
     // if column ordering is given
     if (is_admin() && isset($args['columns'])) {
         $pc = new H_PostColumn($name, $args['columns']);
         $pc->init();
     }
     // If taxonomy is given
     if (isset($args['taxonomy'])) {
         $tax = new H_Taxonomy($name, $args['taxonomy']);
         $tax->init();
     }
     // Add this post type to Jetpack's sitemap
     if (isset($args['sitemap'])) {
         add_filter('jetpack_sitemap_post_types', array($this, 'jetpack_add_cpt'));
     }
     // Allow REST API access
     if (isset($args['rest_api'])) {
         add_filter('rest_api_allowed_post_types', array($this, 'jetpack_add_cpt'));
     }
 }
Beispiel #2
0
 static function register_columns($name, $args)
 {
     if (!is_admin()) {
         return false;
     }
     $pc = new H_PostColumn($name, $args);
     $pc->init();
 }