7
Plugin Name: Hello Dolly
8
Plugin URI: http://wordpress.org/plugins/hello-dolly/
9
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
10
Author: Matt Mullenweg
12
Author URI: http://ma.tt/
15
function hello_dolly_get_lyric() {
16
/** These are the lyrics to Hello Dolly */
17
$lyrics = "Hello, Dolly
19
It's so nice to have you back where you belong
20
You're lookin' swell, Dolly
22
You're still glowin', you're still crowin'
23
You're still goin' strong
24
We feel the room swayin'
25
While the band's playin'
26
One of your old favourite songs from way back when
27
So, take her wrap, fellas
28
Find her an empty lap, fellas
29
Dolly'll never go away again
32
It's so nice to have you back where you belong
33
You're lookin' swell, Dolly
35
You're still glowin', you're still crowin'
36
You're still goin' strong
37
We feel the room swayin'
38
While the band's playin'
39
One of your old favourite songs from way back when
41
Find her a vacant knee, fellas
42
Dolly'll never go away
43
Dolly'll never go away
44
Dolly'll never go away again";
46
// Here we split it into lines
47
$lyrics = explode( "\n", $lyrics );
49
// And then randomly choose a line
50
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
53
// This just echoes the chosen line, we'll position it later
54
function hello_dolly() {
55
$chosen = hello_dolly_get_lyric();
56
echo "<p id='dolly'>$chosen</p>";
59
// Now we set that function up to execute when the admin_notices action is called
60
add_action( 'admin_notices', 'hello_dolly' );
62
// We need some CSS to position the paragraph
63
function dolly_css() {
64
// This makes sure that the positioning is also good for right-to-left languages
65
$x = is_rtl() ? 'left' : 'right';
68
<style type='text/css'>
80
add_action( 'admin_head', 'dolly_css' );