This topic contains 2 replies, has 2 voices, and was last updated by  bicho44 4 years, 2 months ago.

  • Author
    Posts
  • #4067

    bicho44
    Participant

    Hi again, i have a cpt defined, with the hide metabox set to hide the feature image box because iam using the piklist version, but i cant make it work, any pointer will be nice 😀

    
    function barcos_post_type($post_types)
    {
        $post_types['barcos'] = array(
            'labels' => piklist('post_type_labels', 'Barco')
            ,'title' => __('Ingrese un nuevo Barco', 'imgd')
            ,'public' => true
            ,'capability_type' => 'page'
            ,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png')
            ,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
            ,'rewrite' => array(
                'slug' => 'barco'
            )
        ,'supports' => array(
                'title',
                'editor',
                'author',
                'thumbnail' //I need this to use it with helpers,
                'page-attributes'
            )
        ,'hide_meta_box' => array(
                'slug'
                ,'author'
                ,'revisions'
                ,'comments'
                /* here the Feature images */
                ,'thumbnail'
                ,'FeaturedImage'
                ,'Featured Image'
                /* end the Feature images */
                ,'commentstatus'
            )
        );
        return $post_types;
    }
    
  • #4068

    Steve
    Keymaster

    @bicho44– This is definitely a bug. You’re going to need to do this old school:

    function my_remove_postimagediv()
    {
      remove_meta_box('postimagediv', 'barcos', 'side'); 
    }
    add_action('do_meta_boxes', 'my_remove_postimagediv');
    

    More info at the WordPress codex.

  • #4073

    bicho44
    Participant

    Hi Steve:

    Thanks for the info. But…

    FYI
    If we call the hide_meta_boxto the div postimagediv like this

    ,'hide_meta_box' => array(
                /* here the Feature image div */
                ,'postimagediv'
            )

    Works OK and the metabox is hidden

    So, the bug to resolve is maybe Piklist must have an ‘alias’ (?) to that div, maybe, ‘featureimage’ (i like that)

    Also a note in the docs will be a nice addition 😀

    Thanks in advance
    Fede

You must be logged in to reply to this topic.