-
Author
-
March 13, 2014 at 20:50 #12669gazwalParticipant
hi all,
I need to hide some metabox for non-admin on post form
the code below is working , but not for the “Sidebar” metaboxCOPY CODEfunction foyervietnam_remove_post_meta_boxes() { if( !current_user_can('manage_options') ) { remove_meta_box( 'general_settings','post','normal' ); // Kleo Theme General Settings remove_meta_box( 'post_meta','post','normal' ); // Kleo Theme Post Settings remove_meta_box( 'mymetabox_revslider_0','post','normal' ); // Kleo Revolution Slider Options remove_meta_box( 'post_layout','post','side' ); // Kleo Post Layout // this doesn't work remove_meta_box( 'sbg_box','post','normal' ); // Kleo Sidebar } } add_action( 'add_meta_boxes', 'foyervietnam_remove_post_meta_boxes' );
“Sidebar” metabox => http://grab.by/v7vW
please help 😉+ I’m not able to find where metaboxes are declared in Kleo theme folder structure ? ant ideas
cheer
++
robinMarch 13, 2014 at 21:51 #12671sharmstrModeratortry: /kleo-framework/lib/class-multiple.sidebars.php
Oh, and if you have to make a ton of changes to the admin, try adminimize. I was orginally removing metaboxes in functions.php, but switch to adminimize because I can easily hide dashboard and menu items.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 13, 2014 at 23:48 #12680gazwalParticipantok thx, so I really need help cause I’m a poor PHP dev 🙂
/kleo-framework/lib/class-multiple.sidebars.php is an old plugin “Sidebar generator”, seems to be rewrote by Kleo team.
It use PHP class
so I need to do a “remove_action from an external class”COPY CODEclass sidebar_generator { function sidebar_generator(){ .... //edit posts/pages add_action('edit_form_advanced', array('sidebar_generator', 'edit_form')); add_action('edit_page_form', array('sidebar_generator', 'edit_form')); .... } .......
I’ve found 2 articles about that:
well this is to complicated to me 🙁
help ?March 14, 2014 at 18:58 #12716gazwalParticipantany PHP expert that could help me remove an action inside a method function , under a CLASS ?
/kleo-framework/lib/class-multiple.sidebars.php :COPY CODEclass sidebar_generator { function sidebar_generator(){ add_action('init',array('sidebar_generator','init')); add_action('admin_menu',array('sidebar_generator','admin_menu')); add_action('admin_print_scripts', array('sidebar_generator','admin_print_scripts')); add_action('wp_ajax_add_sidebar', array('sidebar_generator','add_sidebar') ); add_action('wp_ajax_remove_sidebar', array('sidebar_generator','remove_sidebar') ); //edit posts/pages add_action('edit_form_advanced', array('sidebar_generator', 'edit_form')); add_action('edit_page_form', array('sidebar_generator', 'edit_form')); //save posts/pages add_action('edit_post', array('sidebar_generator', 'save_form')); add_action('publish_post', array('sidebar_generator', 'save_form')); add_action('save_post', array('sidebar_generator', 'save_form')); add_action('edit_page_form', array('sidebar_generator', 'save_form')); } ........ } $sbg = new sidebar_generator; function generated_dynamic_sidebar($name='0'){ sidebar_generator::get_sidebar($name); return true; }
March 16, 2014 at 12:12 #12788AbeKeymasterHi, This should do the trick:
COPY CODEfunction foyervietnam_remove_post_meta_boxes() { if( !current_user_can('manage_options') ) { remove_meta_box( 'general_settings','post','normal' ); // Kleo Theme General Settings remove_meta_box( 'post_meta','post','normal' ); // Kleo Theme Post Settings remove_meta_box( 'mymetabox_revslider_0','post','normal' ); // Kleo Revolution Slider Options remove_meta_box( 'post_layout','post','side' ); // Kleo Post Layout // sidebar remove_action('edit_form_advanced', array('sidebar_generator', 'edit_form')); remove_action('edit_page_form', array('sidebar_generator', 'edit_form')); } } add_action( 'add_meta_boxes', 'foyervietnam_remove_post_meta_boxes' );
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.March 17, 2014 at 15:41 #12837AbeKeymasterGreat. I am glad it works.
Topic closed.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The topic ‘Hide some Kleo metabox’ is closed to new replies.