Skip to content

Instantly share code, notes, and snippets.

@miya0001
Created June 30, 2012 16:54
Show Gist options
  • Save miya0001/3024606 to your computer and use it in GitHub Desktop.
Save miya0001/3024606 to your computer and use it in GitHub Desktop.
WordPressのAdminバーにオレオレメニューを追加
<?php
class oreore {
function __construct()
{
add_action("admin_bar_menu", array(&$this, "admin_bar_menu"), 9999);
}
public function admin_bar_menu($bar)
{
$bar->add_menu(array(
"id" => "nginxchampuru",
"title" => "Nginx Cache",
"href" => false,
));
if (!is_admin()) {
$bar->add_menu(array(
"parent" => "nginxchampuru",
"id" => "flushcache",
"title" => __("Flush This Page Cache", "oreore"),
"href" => 'http://example.com/',
"meta" => false,
));
}
}
}
$wp_admin_bar->add_menu( array(
'id' => 'wp-logo',
'title' => '<span class="ab-icon"></span>',
'href' => self_admin_url( 'about.php' ),
'meta' => array(
'title' => __('About WordPress'),
),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment