我正在编写一个插件来向博客的所有登录用户显示一些站点信息。
我发现的最简单的方法是将信息附加到管理栏。但是,我想显示更多信息,然后很容易适应。我想将数据放在一个覆盖的 html 框中,当用户将鼠标悬停(或单击)标题时会显示该框。
实际上,我想重新创建“你好”项目的效果。以下是我的插件中的虔诚代码。
$args = array(
'id' => 'counter',
'title' => $visitor_count . ' Unique visitors and ' . $page_views .' Page views',
'href' => '#',
'aria-haspopup' => 'true',
'meta' => array( 'html' => '
<!-- This should be a pop-up message not a fixed box -->
<div style="width:300px;height:100px;background-color:white;box-shadow: 10px 10px 5px #888888;">
here be html
</div>
')
);
$wp_admin_bar->add_node( $args );
希望这对你们都有一些意义。