Viewing 5 reply threads
  • Author
    Posts
    • #2024
      catacaly
      Member

      Anyone else have any clue as to why this might be…?

    • #2027
      Steve
      Keymaster

      @catacaly– I can’t reproduce this issue. Please post your code for the CPT and Tax.

    • #2028
      catacaly
      Member
      
      add_filter('piklist_post_types', 'listing_post_type');
      function listing_post_type($post_types)
      {
        $post_types['vessel'] = array(
          'labels' => piklist('post_type_labels', 'Listing')
          ,'title' => __('Enter boat name')
          ,'public' => true
      	,'hierarchical' => false
      	,'has_archive' => true
          ,'rewrite' => false/*array(
            'slug' => 'vessel'
          )*/
          ,'supports' => array(
      	  'title'
            ,'author'
            ,'revisions'
      	  ,'thumbnail'
      	  //,'editor'
      	  //,'excerpt'
          )
      	,'can_export' => true
          ,'edit_columns' => array(
              'title' => __('Name')
              ,'author' => __('Created by')
          )
          ,'hide_meta_box' => array(
            'slug'
            ,'author'
            //,'revisions'
            //,'comments'
            //,'commentstatus'
          )
      	,'post_states' => true
      	,'status' => array(
      		'draft' => array(
      		  'label' => 'Draft'
      		  ,'public' => false
      		)
      		,'active' => array(
      		  'label' => 'For Sale'
      		  ,'public' => true
      		)
      		,'inactive' => array(
      		  'label' => 'Inactive'
      		  ,'public' => false
      		)
      		,'contract' => array(
      		  'label' => 'Under Contract'
      		  ,'public' => true
      		)
      		,'sold' => array(
      		  'label' => 'Sold'
      		  ,'public' => true
      		)
      		,'expired' => array(
      		  'label' => 'Expired'
      		  ,'public' => false
      		)
      	)
          ,'capabilities' => array(
              'edit_post' => 'edit_listing',
              'edit_posts' => 'edit_listings',
              'edit_others_posts' => 'edit_others_listings',
              'publish_posts' => 'publish_listings',
              'read_post' => 'read_listing',
              'read_private_posts' => 'read_private_listings',
              'delete_post' => 'delete_listing'
          ) 
          ,'map_meta_cap' => true
        );
       return $post_types;
      }
      
      function apply_listing_caps() {
          // gets the administrator role
          $admins = get_role( 'administrator' );
      
          $admins->add_cap( 'edit_listing' ); 
          $admins->add_cap( 'edit_listings' ); 
          $admins->add_cap( 'edit_others_listings' ); 
          $admins->add_cap( 'publish_listings' ); 
          $admins->add_cap( 'read_listing' ); 
          $admins->add_cap( 'read_private_listings' ); 
          $admins->add_cap( 'delete_listing' ); 
      	
      	add_role( 'dd', 'DD', array(
      		'edit_listing' => true,
      		'edit_listings' => true,
      		'edit_others_listings' => true,
      		'publish_listings' => true,
      		'read_listing' => true,
      		'read_private_listings' => true,
      		'delete_listing' => false
      	));
      }
      add_action( 'admin_init', 'apply_listing_caps');
      
      add_filter('piklist_taxonomies', 'vessel_make_models');
      function vessel_make_models($taxonomies)
      {
         $taxonomies[] = array(
            'post_type' => 'vessel'
            ,'name' => 'make'
            ,'show_admin_column' => true
            ,'hide_meta_box' => true
            ,'configuration' => array(
              'hierarchical' => false
              ,'labels' => piklist('taxonomy_labels', 'Manufacturer')
              ,'show_ui' => true
              ,'query_var' => true
              ,'rewrite' => array( 
                'slug' => 'make' 
              )
            )
          );
         $taxonomies[] = array(
            'post_type' => 'vessel'
            ,'name' => 'model'
            ,'show_admin_column' => true
            ,'hide_meta_box' => true
            ,'configuration' => array(
              'hierarchical' => false
              ,'labels' => piklist('taxonomy_labels', 'Model')
              ,'show_ui' => true
              ,'query_var' => true
              ,'rewrite' => array( 
                'slug' => 'model' 
              )
            )
          );
      	return $taxonomies;
      }
      
    • #2030
      Steve
      Keymaster

      There was a typo in our documentation. hide_meta_box should go inside the configuration array:

      ,'configuration' => array(
        'hierarchical' => false
        ,'hide_meta_box' => true
        ,'labels' => piklist('taxonomy_labels', 'Model')
        ,'show_ui' => true
        ,'query_var' => true
        ,'rewrite' => array( 
          'slug' => 'model' 
        )
      )
      

      Our documentation has been updated >

    • #2031
      catacaly
      Member

      Thanks. I should’ve tried that.

      Same with show_admin_column, while you’re at it 🙂

    • #2032
      catacaly
      Member

      Is there an easy-peasy-Piklist way of adding custom or default fields to admin columns?

Viewing 5 reply threads
  • The topic ‘Taxonomies with 'hide_meta_box' => true still showing metaboxes?’ is closed to new replies.