Wordpress の管理バーを、登録ユーザーにとってより便利なものに変換しようとしています。クライアントから、数秒間表示されてから消えるインスタント メッセージを表示するスペースをそのバーに追加するように依頼されました。このスペースにより、オンラインのユーザーは、誰かがチャットのようにメッセージを送信しているかどうかを確認できるようになります。
class MessageMenu{
function MessageMenu(){
add_action( 'admin_bar_menu', array( $this, 'message_section' ) );
}
function add_message( $message, $timeout = 2000 ){
// This function should add a new live message to the admin bar
// First it should check if there is a current message
// Then write the new message
global $wp_admin_bar;
}
function message_section(){
// This function will supposedly create a
global $wp_admin_bar;
$args = array(
'id' => 'message_section',
'title' => __( 'Mensajes' ),
'parent'=> false,
'href' => false,
'group' => true );
$wp_admin_bar->add_node( $args );
$this->add_message( 'Live messages' );
}
}
function MessageMenuInit(){
global $MessageMenu;
$MessageMenu = new MessageMenu();
}
add_action( 'init', 'MessageMenuInit' );