WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created some content using php, js and html which shows the bandwidth the site has used (using the cPanel API and the Google Graphs API) I want this to be shown on the dashboard in Wordpress (viewable to Admins and Editors only)

How do I do this?

share|improve this question
I'm very new to Wordpress, so I'm not sure how to achieve this. After reading this it looks like I would need to create a widget, but I don't know how to. I also don't know where I would have to add the code. Is there not an easy way to add a some static code? Or a blank widget that I could add some code to? – baritoneuk Aug 10 '11 at 19:46
up vote 1 down vote accepted
Plugin Name: Dashboard Google Page Rank
Plugin URI: http://wordpress.org/extend/plugins/dashboard-google-pagerank/
Description: Shows your google pagerank in the wordpress dashboard
Author: Weston Deboer
Version: 1.1
Author URI: http://westondeboer.com
function gpr_wp_dashboard_test() {

function gpr_wp_dashboard_setup() {
    wp_add_dashboard_widget( 'gpr_wp_dashboard_test', __( 'Google Page Rank' ),'gpr_wp_dashboard_test');
add_action('wp_dashboard_setup', 'gpr_wp_dashboard_setup');


I have made a small modification to the above plugin. But all you should need to do is include your file which displays the data and it should show your widget in the admin dashboard.

share|improve this answer
You don't need parentheses on includes. Also note, you didn't give an example of how to limit that dashboard widget to the admin and editor roles(which was part of the original question). Add that into your answer and i'll +1 you... ;) – t31os Aug 11 '11 at 10:18
You don't need paretheses but I find using them on includes more asthetically pleasing. Yes, it would be useful to know how I can show the widget for admin and editor. – baritoneuk Aug 12 '11 at 9:03
Although I was hoping to know how I can show this widget for the specific roles of admin and editor, this answer has been most helpful and so I am marking it as the accepted answer. – baritoneuk Aug 18 '11 at 14:30
@baritoneuk: just wrap the wp_add_dashboard_widget() call in if (current_user_can('administrator') || current_user_can('editor')) { }. – Geert Sep 20 '11 at 11:30

Simply open your functions.php file and add the following code:

add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');

function my_custom_dashboard_widgets() {
global $wp_meta_boxes;

wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');

function custom_dashboard_help() {
echo '<p>your Text Here <a href="mailto:yourusername@gmail.com">here</a>. Your Text : <a href="http://www.xxxx.com" target="_blank">Your Title</a></p>';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.