02 admin_notices 管理者後台時,通知管理者動作

    在官方的plugin/hello.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' );
    
    

    Screen_Shot_2016-01-13_at_12_21_06_PM