Considering how regularly new versions of Firefox now come along, that's quite some bug fix list in version 10! http://t.co/K3I2vLpW 1 week ago

14th
May 10

Adding information to your WordPress dashboard



closeThis post was written 1 year 8 months 28 days days old, so is a bit old now. Feel free to read and comment on this post, just remember some things change with time and any facts in this post may not be accurate anymore.

Dashboard ScreenshotIf you wish to add a widget to your WordPress dashboard then that’s a different, and longer, discussion. Instead I’m going to show you how to add a simple message, of your choosing, to the “Right Now” box.

How could you use this? You could use a database lookup beforehand, for instance, to report on useful blog/theme information. I’m using it right now to report on how my competition is running – I’m performing a count on the table and reporting the output back (see image to the right).

First of all, you need to add an action for activity_box_end pointing to your new function. All of the code discussed here should be put in your theme’s functions.php file. In this example I’m pointing it to a function named show_admin_message

add_action('activity_box_end','show_admin_message');

Within your function you then simply need to output the HTML. Here’s a complete piece of code that you can use…

add_action('activity_box_end','show_admin_message');
function show_admin_message() {
   $output_text = "Put your output message here";
   echo '<div style="border: 1px solid #ffd700; margin: 10px 0 0; padding: 5px; background: #ffffba; color: #000;">'.= __($output_text).'</div>';
}

This will display the text “Put your output message here” in a yellow box, with a darker yellow border. The text will be in black.

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly

4 Comments

  1. Andy says:

    Hi is there a reason this has no effect in wp 3.0? Or is there a wrong and right place to position the code in functions.php

    thanks for a great idea to keep in touch with contributors. There is a small plugin to leave message in the New Post section, but a welcome message to new contributors is more interesting

    cheers

    • David says:

      No, it works fine with WP 3.0 (which I’m using now and still have the competition details displaying). Are you using the multi-user features, because I’ve not tested that.

  2. Andy says:

    no MU, I will try it again.It can go anywhere? or best at a certain point?

No Pingbacks/Trackbacks

    Leave a Comment

    All comments are approved manually. No spam please, or comments that add nothing to the conversation.

    Your email address will not be published. Required fields are marked *

    *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>