Skip to content

Instantly share code, notes, and snippets.

View rsharrer's full-sized avatar

Ryan Sharrer rsharrer

View GitHub Profile
@rsharrer
rsharrer / Remove admin left menu other than me
Created September 26, 2013 13:44
Remove admin left menu other than me
function remove_menus() {
global $menu;
global $user_level;
get_currentuserinfo();
if($display_name != 'rsharrer') {
$restricted = array(
__('Posts'),
__('Comments'),
__('Appearance'),
__('Plugins'),
@rsharrer
rsharrer / Remove Left admin menu for non admin.php
Created September 26, 2013 13:42
Remove Left admin menu for non admin
function remove_menus() {
global $menu;
global $user_level;
get_currentuserinfo();
if($user_level != 10) {
$restricted = array(
__('Posts'),
__('Comments'),
__('Appearance'),
__('Plugins'),
@rsharrer
rsharrer / Add your own Dashboard Widgets.php
Created September 26, 2013 13:42
Add your own Dashboard Widgets
//add your own dashboard widget
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget('custom_help_widget','Global Web Developer Inc','custom_dashboard_help');
}
function custom_dashboard_help() {
echo '<p>Welcome to Custom Blog Theme! Need help? Contact the developer <a href="mailto:[email protected]">here</a>. For WordPress Tutorials visit: <a href="http://www.webdesign.com" target="_blank">WebDesign.com</a></p>';
}
add_action('wp_dashboard_setup','my_custom_dashboard_widgets');
@rsharrer
rsharrer / Add Your own WordPress Admin Toolbar.php
Created September 26, 2013 13:40
Add Your own WordPress Admin Toolbar
//Add Admin Toolbar items
function easy_add_menu_items_to_toolbar() {
global $wp_admin_bar;
if (!is_super_admin() || !is_admin_bar_showing())
return;
$wp_admin_bar->add_menu(array(
'id' => 'webdev_links',
'title' => __('Awesome WebDev'),
'href' => __('http://domain.com'),
));
@rsharrer
rsharrer / Remove items from the WordPress Admin Toolbar.php
Created September 26, 2013 13:40
Remove items from the WordPress Admin Toolbar
//Start remove admin toolbar items
function remove_admin_toolbar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('builder');
$wp_admin_bar->remove_menu('new-content');
@rsharrer
rsharrer / Remove Dashboard Items.php
Created September 26, 2013 13:39
Remove Dashboard Items
//remove dashboard items
function 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']);
@rsharrer
rsharrer / Remove admin menu items.php
Created September 26, 2013 13:39
Remove admin menu items
//start remove admin menus
function remove_menus() {
global $menu;
$restricted = array(
__('Posts'),
__('Dashboard'),
__('Comments'),
__('Appearance'),
__('Plugins'),
__('Tools'),
@rsharrer
rsharrer / Remove certain meta-boxes from the Pages edit screen.php
Created September 26, 2013 13:38
Remove certain meta-boxes from the Pages edit screen
function remove_default_page_screen_metaboxes() {
remove_meta_box( 'commentstatusdiv','page','normal' ); // Comments
remove_meta_box( 'trackbacksdiv','page','normal' ); // Talkback
}
add_action('admin_menu','remove_default_page_screen_metaboxes');
@rsharrer
rsharrer / Get rid of widgets that have to do with blogging.php
Created September 26, 2013 13:37
Get rid of widgets that have to do with blogging.
function unregister_default_wp_widgets() {
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Categories');
unregister_widget('WP_Widget_Recent_Posts');
unregister_widget('WP_Widget_Recent_Comments');
unregister_widget('WP_Widget_RSS');
unregister_widget('WP_Widget_Tag_Cloud');
}
add_action('widgets_init', 'unregister_default_wp_widgets', 1);
@rsharrer
rsharrer / Add Categories and Tags to the Pages.php
Created September 26, 2013 13:36
WP-Functions /Add Categories and Tags to the Pages
function add_cat_tag_page() {
add_meta_box('tagsdiv-post_tag', __('Page Tags'), 'post_tags_meta_box', 'page', 'side', 'low');
register_taxonomy_for_object_type('post_tag','page');
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box','page','side','core');
register_taxonomy_for_object_type('category','page');
}
add_action('admin_init','add_cat_tag_page');
function page_tag_cat_request($q) {
if (isset($q['tag']) || isset($q['category']))