This was already posted but it did not have the full list of items. Especially those annoying “incoming links!” add_action(‘wp_dashboard_setup’, ‘my_custom_dashboard_widgets’); function my_custom_dashboard_widgets() { global $wp_meta_boxes; //Right Now – Comments, Posts, Pages at a glance unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]); //Recent Comments unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_recent_comments’]); //Incoming Links unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]); //Plugins – Popular, New and Recently updated WordPress Plugins unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]); //Wordpress Development Blog […]
Articles Tagged: 2015
Function to change the length of Excerpt
Tested on: WordPress 3.0.1 By default all excerpts are capped at 55 words. Utilizing the code below you can override this default settings: function new_excerpt_length($length) { return 100; } add_filter(‘excerpt_length’, ‘new_excerpt_length’); This example changes the excerpt length to 100 words, but you can use the same method to change it to any value.
Customize the Dashboard
add_action(‘wp_dashboard_setup’, ‘my_custom_dashboard_widgets’); function my_custom_dashboard_widgets() { global $wp_meta_boxes; Remove these dashboard widgets… unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]); unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]); unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]); Add a custom widget called ‘Help and Support’ wp_add_dashboard_widget(‘custom_help_widget’, ‘Help and Support’, ‘custom_dashboard_help’); } This is the content for your custom widget function custom_dashboard_help() { echo ‘<p>Lorum ipsum delor sit amet et nunc</p>’; }
Customize the order of the admin menu
tested on: WordPress 3.0.1 This code will allow you to reorganize the order of elements in the admin menu. All that you need to do is click on an existing link in the admin menu and copy everything before the /wp-admin/ URL. The order below represents the order the new admin menu will have. // […]
Add Custom User Profile Fields
Place the code below into your functions.php file to add custom user profile fields. Edit or add lines as you see fit.Remember not to remove the line: return $contactmethods; otherwise this won’t work. // CUSTOM USER PROFILE FIELDS function my_custom_userfields( $contactmethods ) { // ADD CONTACT CUSTOM FIELDS $contactmethods[‘contact_phone_office’] = ‘Office Phone’; $contactmethods[‘contact_phone_mobile’] = ‘Mobile […]
Loading jQuery from the Google CDN
Tested on: WordPress 3.0.1 // even more smart jquery inclusion 🙂 add_action( ‘init’, ‘jquery_register’ ); // register from google and for footer function jquery_register() { if ( !is_admin() ) { wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ( ‘https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’ ), false, null, true ); wp_enqueue_script( ‘jquery’ ); } } Â
Remove Update Notification for all users except ADMIN User
ONLY show update notification for admin users (as opposed to just the user ‘admin’): // REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN global $user_login; get_currentuserinfo(); if (!current_user_can(‘update_plugins’)) { // checks to see if current user can update plugins add_action( ‘init’, create_function( ‘$a’, “remove_action( ‘init’, ‘wp_version_check’ );” ), 2 ); add_filter( ‘pre_option_update_core’, create_function( […]
Enable Hidden Admin Feature displaying ALL Site Settings
This little piece of code does something pretty cool. It will add an additional option to your settings menu with a link to “all settings” which will show you a complete list of all the settings you have within your database related to your wordpress site. The code below will only made this link visible […]