Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed unset for recent_drafts dashboard widget, added some condition …

…comments to wrap functions
  • Loading branch information...
commit cd0b1e26113690b07b7f8ded52441138877e0729 1 parent 4299c48
@wycks authored
Showing with 31 additions and 7 deletions.
  1. +3 −0  functions.php
  2. +28 −7 snippets/remove-stuff.php
View
3  functions.php
@@ -48,5 +48,8 @@
// add stuff
//require_once( get_template_directory() . '/snippets/add-stuff.php' );
+//
+//
+
?>
View
35 snippets/remove-stuff.php
@@ -39,7 +39,7 @@ function Wps_remove_default_post_metaboxes() {
remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox
remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
}
- add_action('admin_menu','Wps_remove_default_post_metaboxes');
+ add_action('admin_menu','Wps_remove_default_post_metaboxes');
//-----------------------------------------
@@ -53,7 +53,7 @@ function Wps_remove_default_page_metaboxes() {
remove_meta_box( 'slugdiv','page','normal' ); // Slug Metabox
remove_meta_box( 'authordiv','page','normal' ); // Author Metabox
}
- add_action('admin_menu','Wps_remove_default_page_metaboxes');
+add_action('admin_menu','Wps_remove_default_page_metaboxes');
//-----------------------------------------
@@ -62,20 +62,19 @@ function Wps_remove_default_page_metaboxes() {
function Wps_remove_dashboard_widgets() {
global $wp_meta_boxes;
- unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
- unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
+
+ unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
+ unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
+add_action('wp_dashboard_setup', 'Wps_remove_dashboard_widgets' );
-if (!current_user_can('manage_options')) {
- add_action('wp_dashboard_setup', 'Wps_remove_dashboard_widgets' );
-}
//-----------------------------------------
@@ -155,6 +154,28 @@ function complete_version_removal() {
add_filter('the_generator', 'complete_version_removal');
+// USER Conditionals to wrap functions
+//
+// # by user capability
+// if (!current_user_can('manage_options')) { ..
+//
+// ---------------------
+//
+// # by username#
+//
+// global $wp_meta_boxes;
+// global $current_user;
+// get_currentuserinfo();
+//
+// if($current_user->user_login == 'username'){ ..
+//
+// ----------------------
+//
+// #if the user is an admin - by user role#
+//
+// if ( ! is_admin() ) {..
+
+
?>
Please sign in to comment.
Something went wrong with that request. Please try again.