Home › Toolset Professional Support › [Resolved] Hide Template Layout selection for non Admin
Problem:
How to Hide or remove Template Layout selection for non Admin
Solution:
To remove Toolset buttons you need to add custom code to your current theme's functions.php file.
You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/hide-template-layout-selection-for-non-admin/#post-614589
Relevant Documentation:
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Tagged: Access plugin, Types plugin, Views plugin
This topic contains 6 replies, has 2 voices.
Last updated by Cesar 6 years, 9 months ago.
Assisted by: Minesh.
Hi,
I need to hide the Template Layout box for non Admin.
When doing so using regular WP Screen options the template layout box is always visible. Is totally useless information for an author or editor and is not translated
Is that the supposed behavior? or am I missing somethinh
Thanks
The same for Types and Access short codes, Content Layout Editor is not even something that an Author can use, they are not allowed by default within the plugin
Can I get ride of them for non Admin users?
Thanks
Hello. Thank you for contacting the Toolset support.
Well - to remove Toolset buttons you need to add following code to your current theme's functions.php file:
function func_remove_unwanted_toolset_buttons(){ // only remove buttons on back end for non-administrators if ( is_admin() && !current_user_can( 'manage_options' ) ) { // remove the Fields and Views button add_filter( 'toolset_editor_add_form_buttons', '__return_false' ); // remove the CRED button add_filter( 'toolset_cred_button_before_print', '__return_false' ); // remove the Access button for all roles add_filter( 'toolset_editor_add_access_button', function(){ global $wp_roles; $all_roles = array_keys($wp_roles->roles); return $all_roles; } ); } } add_action( 'init', 'func_remove_unwanted_toolset_buttons' );
To hide "Content Layout Editor" button:
1) add following code to your current theme's functions.php file:
add_action( 'admin_init', 'my_admin_init' ); function my_admin_init() { if(!current_user_can('manage_links')) { wp_enqueue_style( 'myStylesheet', get_stylesheet_directory_uri() . '/myStylesheet.css' ); } }
2) create a css file "rm-content-layout-editor.css", put it in your theme root folder.with following code:
div.wp-media-buttons a.js-layout-private-add-new-top { display:none !important; }
To remove Template Layout box for non Admin.
add_action( 'admin_head', 'wpv_custom_admin_head', 20); function wpv_custom_admin_head() { remove_meta_box( 'wpddl_template', array("your-post-type-slug"), 'side' ); // replace book with your CPT slug }
Where:
Replace "your-post-type-slug" with your post type slug for which you want to hide the "Template Layout" box.
More info:
=> http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table
Here is more details about WordPess standard function: remove_meta_box
More info:
https://codex.wordpress.org/Function_Reference/remove_meta_box
You can mark this resolved as well 🙂
Yes I will 😉
But I need to bother you just a little more
How can I hide the Toolset shortcode on the top admin bar and the <if> shortcode from the text box?
Please 🙂
Thanks
Yes - I'm happy to help you with your new question as well and I'm here to help you But may I kindly ask you to open a new ticket for your each new question.
This will help other users searching on the forum. Thank you for understanding.
Even you can create a new ticket and assign it to me.
Sorry, considering is the same question I thought this should be the place to ask