WC_Admin_Menus::admin_bar_menus() public WC 2.4.0
Add the "Visit Store" link in admin bar main menu.
{} Это метод класса: WC_Admin_Menus{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WC_Admin_Menus = new WC_Admin_Menus(); $WC_Admin_Menus->admin_bar_menus( $wp_admin_bar );
- $wp_admin_bar(WP_Admin_Bar) (обязательный)
- Admin bar instance.
Список изменений
С версии 2.4.0 | Введена. |
Код WC_Admin_Menus::admin_bar_menus() WC Admin Menus::admin bar menus WC 5.0.0
public function admin_bar_menus( $wp_admin_bar ) {
if ( ! is_admin() || ! is_admin_bar_showing() ) {
return;
}
// Show only when the user is a member of this site, or they're a super admin.
if ( ! is_user_member_of_blog() && ! is_super_admin() ) {
return;
}
// Don't display when shop page is the same of the page on front.
if ( intval( get_option( 'page_on_front' ) ) === wc_get_page_id( 'shop' ) ) {
return;
}
// Add an option to visit the store.
$wp_admin_bar->add_node(
array(
'parent' => 'site-name',
'id' => 'view-store',
'title' => __( 'Visit Store', 'woocommerce' ),
'href' => wc_get_page_permalink( 'shop' ),
)
);
}