http://codex.WordPress.org/Function_Reference/do_action
http://codex.WordPress.org/Function_Reference/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}!";
}
}
主题猫WP建站,累计帮助1300+客户成功建站,为站长提供支持!
立刻开启你的建站之旅