Skip to content

Instantly share code, notes, and snippets.

View rsharrer's full-sized avatar

Ryan Sharrer rsharrer

View GitHub Profile
@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 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 / 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 / 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 / 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 / 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 / Set Maximum Post Title Length.php
Created September 26, 2013 13:45
Set Maximum Post Title Length
//set post title length
function maxTitleLength($title) {
global $post;
$title = $post->post_title;
if (str_word_count($title) >= 10)
wp_die( __('Error: your post title is over the maximum word count.'));
}
add_action('publish_post','maxTitleLength');
@rsharrer
rsharrer / Changing the WordPress Read More Text.php
Created September 26, 2013 13:46
Changing the WordPress Read More Text
$custom_morelink = "Continue Reading the Full Article";
function change_more_link($more_link, $more_link_text) {
return str_replace($more_link_text, $custom_morelink, $more_link);
}
add_filter('the_content_more_link', 'change_more_link', 10, 2);
@rsharrer
rsharrer / displays search box.php
Created September 26, 2013 13:47
displays search box
<?php get_search_form(); ?>
@rsharrer
rsharrer / new_gist_file
Created September 26, 2013 13:48
Ace Doran Functions
<?php
// Add Builder 3.0 Support
add_theme_support( 'builder-3.0' );
// Making all module outer wrappers full width
function it_set_full_width_container( $width ) {
remove_filter( 'builder_get_container_width', 'it_set_full_width_container' );
return '';