This document provides code snippets to customize the WordPress admin interface for clients. It includes:
1) Customizing the login screen by adding a logo and link.
2) Giving editors menu and widget permissions.
3) Adding branding to the title bar and footer by including the developer's logo and contact details.
4) Removing unnecessary widgets from the dashboard and adding support information and an RSS feed.
5) Instructions for setting up automatic plugin updates by adding metadata and uploading files to a web server.
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress Plugin
1. MAKING WORDPRESS
YOUR CMS
Remind clients that you exist
Provide support contact details
Provide helpful hints
Tell your clients what you’re doing
Automatically Update Your Plugin
2. CUSTOM
LOGIN
SCREEN
•Add clients logo
•Add link to your site
•Move Error messages above
the logo
3. LOGIN LOGO
<?php
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('siteurl').'/wp-
content/custom-login-logo.png) !important; }
.login .message { margin-top:-150px;margin-bottom:
110px;}
</style>';
}
4. LOGIN YOUR LINK
<?php
function my_custom_login_credit() { ?>
<p style="position:absolute;top:428px;left:50%;margin-left:
5px;">served by <a href="http://www.yourdomain.com"
title="Your Name" style="text-decoration:none;">Your
Name</a></p>
<?php }
add_action('login_footer', 'my_custom_login_credit');
?>
5. CUSTOM
LOGIN
SCREEN
•Add clients logo
•Add link to your site
7. EDITOR PERMISSIONS
<?php
// get the the role object
$role_object = get_role( 'editor' );
// add capability to this role object
$role_object->add_cap( 'edit_theme_options' );
?>
17. DECLUTTER THE DASHBOARD
<?php
// remove unnecessary dashboard widgets
function remove_dashboard_widgets(){
global $wp_meta_boxes;
// do not remove "Right Now" for administrators
if (!current_user_can('activate_plugins')) {
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
}
// remove widgets for everyone
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
?>
18. DECLUTTER THE DASHBOARD
<?php
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget('my_note_widget', 'Your Name Support', 'custom_dashboard_me');
}
function custom_dashboard_me() {
echo '<p>Welcome to your WordPress Dashboard, from here you can edit all of the content on
your website.</p><p>Need help? For support please email us at <a
href="mailto:you@yourdomain.com">you@yourdomain.com</a>.</p><p>You can find more
information on our <a href="http://www.yourdomain.com" title="Your Title">website</a>.</p>';
}
?>
19. DECLUTTER THE DASHBOARD
<?php
add_action('wp_dashboard_setup', 'my_dashboard_widgets');
function my_dashboard_widgets() {
global $wp_meta_boxes;
// add a custom dashboard widget
wp_add_dashboard_widget( 'dashboard_custom_feed', 'My News',
'dashboard_custom_feed_output' ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
echo '
<div class="rss-widget">';
wp_widget_rss_output(array(
'url' => 'http://www.yourdomain.com/rss', //put your feed URL here
'title' => 'My News',
'items' => 3, //how many posts to show
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1
));
echo "</div>
";
}
?>
21. RECAP
•Make the login screen look pretty
•Allow Editors to manage menus and widgets
•Add your details and logo to the title bar
•Put your name in the footer and remove confusing links
•Make the dashboard less confusing and more useful
•Add these codes to functions.php
•Or even better, your own plugin
•If you create a plugin and add it to all your client sites...
•... enable automatic updates before you start!
22. HOW TO - AUTO UPDATES
• Visit
http://w-shadow.com/blog/2010/09/02/automatic-
updates-for-any-plugin/
• Update plugin header
• Create metadata.json
• Zip your plugin
• Upload metadata.json and plugin.zip to web server
25. UPLOAD ‘PLUGIN UPDATES’
•Download the file from w-shadow.com
•Add the file to your plugin folder
•Have a beer
•This sets up the WordPress schedule
•Checks every 12 hours
28. UPLOAD TO SERVER
•Upload metadata.json and plugin.zip to your webserver
•Manually update the plugin on client site
•Ensure client site plugin is looking at your server
•Wait... (now is a good time for another beer!)
•... an hour later, or 12!
29. UPLOAD TO SERVER
•Upload metadata.json and plugin.zip to your webserver
•Manually update the plugin on client site
•Ensure client site plugin is looking at your server
•Wait... (now is a good time for another beer!)
•... an hour later, or 12!
30. UPLOAD TO SERVER
•Upload metadata.json and plugin.zip to your webserver
•Manually update the plugin on client site
•Ensure client site plugin is looking at your server
•Wait... (now is a good time for another beer!)
•... an hour later, or 12!