wordpress API

wordpress的do_action和add_action的介绍

日期:2015-04-24 阅读:1684

dmandwp系统 - wordpress系统和DM系统区块建站>>

http://codex.wordpress.org/Function_Reference/do_action

http://codex.wordpress.org/Function_Reference/add_action

http://frumph.net/2010/06/14/understanding-do_action-and-add_action/

代码:

do_action('mytheme_aboveblog');

add_action('mytheme_aboveblog',  'mytheme_online_user_message');
 
function mytheme_online_user_message() { 
    global  $current_user; 
    if (!empty($current_user)) { 
        $user_login = addslashes($current_user->user_login); 
        echo "Hello {$user_login}!"; 
    } 
}

 

 

<<点击返回