Last active
August 29, 2015 14:10
-
-
Save kevinwhoffman/75b5ed13e6b88ce8a4a2 to your computer and use it in GitHub Desktop.
WordPress - functions.php Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove unnecessary menu items from admin menu | |
function remove_menus () { | |
if( is_admin() ) { | |
global $menu; | |
$restricted = array( | |
// __('Posts'), | |
// __('Comments') | |
); | |
end ($menu); | |
while (prev($menu)){ | |
$value = explode(' ',$menu[key($menu)][0]); | |
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);} | |
} | |
} | |
} | |
add_action('admin_menu', 'remove_menus'); | |
// Remove default dashboard widgets | |
function remove_dashboard_meta() { | |
if( is_admin() ) { | |
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); | |
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' ); | |
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); | |
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');//since 3.8 | |
} | |
} | |
add_action( 'admin_init', 'remove_dashboard_meta' ); | |
// Replace admin footer text | |
function modify_footer_admin () { | |
if( is_admin() ) { | |
// echo 'Place footer text here.'; | |
} | |
} | |
add_filter('admin_footer_text', 'modify_footer_admin'); | |
// Give editors access to Gravity Forms | |
function add_grav_forms(){ | |
$role = get_role('editor'); | |
$role->add_cap('gform_full_access'); | |
} | |
add_action('admin_init', 'add_grav_forms'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment