Support » Plugin: Verve Meta Boxes » [Plugin: Verve Meta Boxes] Requiring custom-fields "support" is inconvenient

  • I’ve put Verve Metaboxes to work on a couple client sites and find it very effective. But I find myself commenting out the post_type_supports() requirement for ‘custom-fields’ in verve-meta-boxes/admin/meta_boxes.php

    Removing custom-fields from supported post features has the effect of removing the default “Custom Fields” edit UI – which is exactly what I want. After defining a user-friendly custom UI for postmeta storage, I don’t want the “Custom Fields” metabox also hanging around. But due to Verve’s post_type_supports() requirement, it does unless I also configure Adminimize to hide “Custom Fields”.

    It looks to me like (with the exception of revisions usage) the WP core is using post_type_supports() to control UI elements, not to circumvent data storage or retrieval. If you still decide to stick with post_type_supports() requirement, please consider at least providing the option to hide the “Custom Fields” metabox.

    http://wordpress.org/extend/plugins/verve-meta-boxes/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author avenueverve

    (@avenueverve)

    I will probably automatically hide the custom post meta box on any post type that uses verve post meta. Coming soon to an upgrade near you! 😀

    You can easily hide the Custom Fields meta box using a plugin such as Adminimize.

    Thread Starter Kevin Behrens

    (@kevinb)

    Yeah, having Verve hide the default Custom Fields UI itself is just a convenience issue. Maybe also a slight performance benefit (to reduce memory usage) if that’s all you would have used Adminimize for.

    // you can remove metaboxes of a especified post type

    function my_remove_meta_boxes() {

    remove_meta_box(‘postcustom’, ‘slide’, ‘normal’);

    }

    add_action( ‘admin_menu’, ‘my_remove_meta_boxes’ );

    I agree KevinB, i don’t want the client to see the custom fields box and as a developer I can´t spend time enabling support for custom-fields, then create the meta boxes and finally remove support for custom-fields, so here’s what i do to solve this “issue”:

    Edit the meta_boxes.php file so that custom post types show up in the context list:

    if(function_exists('post_type_supports')){
        $post_types = get_post_types();
        //edit:
        $excluded_post_types = array('attachment', 'revision', 'nav_menu_item');
        // edit end;
        foreach($post_types as $key => $value){
    	// edit:
    	if (in_array($value, $excluded_post_types)) {
    	    unset($post_types[$key]);
    	}
    	// edit end;
    
    	// original code:
    	/*if ( !post_type_supports($value, 'custom-fields') ){
    	    unset($post_types[$key]);
    	}*/
        }
    }else{
        $post_types = array('post','page');
    }

    That is all there is to it, nothing gets broken and we developers can select our custom post types in the “context” list without enabling “custom-fields” for them (enabling custom-fields for a custom post type simply shows the user the custom-fields box on the write/edit admin panel but does not have any other consequences so this hack is safe, nothing will break). If I’m wrong correct me of course.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Verve Meta Boxes] Requiring custom-fields "support" is inconvenient’ is closed to new replies.