Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bentasm1/9301068 to your computer and use it in GitHub Desktop.
Save bentasm1/9301068 to your computer and use it in GitHub Desktop.
/* Remove certain boxes from add item for sellers */
function is_not_admin(){
global $current_user;
get_currentuserinfo();
if ($current_user->user_level < 7) {
return true;
}
else{
return false;
}
}
add_action( 'admin_head', 'my_remove_meta_boxes', 0 );
function my_remove_meta_boxes(){
if (is_not_admin()) {
remove_meta_box( 'postcustom', 'product', 'normal');//remove Custom Fields
remove_meta_box( 'slugdiv', 'product', 'normal');//remove Slug Box
remove_meta_box( 'commentsdiv', 'product', 'normal');//remove Comment Box
remove_meta_box( 'commentstatusdiv', 'product', 'normal');//remove Discussion Box
remove_meta_box( 'postexcerpt', 'product', 'normal');//remove Short Descriptions
remove_meta_box( 'woothemes-settings', 'product', 'normal');//remove WooThemes Content Box
remove_meta_box( 'woocommerce-product-addons', 'product', 'side');//remove Product Addon Box
}
///Show Visual Editor Fix///
add_filter ( 'user_can_richedit' , create_function ( '$a' , 'return true;' ) , 50 );
}
/* Default description for items when seller adds item */
add_filter( 'default_content', 'my_editor_content', 10, 2 );
function my_editor_content( $content, $post ) {
switch( $post->post_type ) {
case 'product':
$content = 'This is the description of what your selling. If its a video, be sure to include the resolution and length. The better the description, the better chances your item will sell!';
break;
default:
$content = '';
break;
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment