在官方的plugin/hello.php
[php]
Function hello_dolly_get_lyric () {
/** These are the lyrics to Hello Dolly */
$lyrics = "Hello, Dolly
Well, hello, Dolly
Dolly’ll never go away again";
// Here we split it into lines
$lyrics = explode( "\n", $lyrics );
// And then randomly choose a line
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) – 1 ) ] );
}
// This just echoes the chosen line, we’ll position it later
function hello_dolly() {
$chosen = hello_dolly_get_lyric();
echo "<p id=’dolly’>$chosen</p>";
}
// Now we set that function up to execute when the admin_notices action is called
//add_action( ‘admin_notices’, ‘hello_dolly’ );
add_action( ‘admin_footer’, ‘hello_dolly’ );