WC_Admin_Menus::admin_bar_menus( WP_Admin_Bar $wp_admin_bar )
Add the “Visit Store” link in admin bar main menu.
Description Description
Parameters Parameters
- $wp_admin_bar
-
(Required) Admin bar instance.
Source Source
File: includes/admin/class-wc-admin-menus.php
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' ), ) ); }
Changelog Changelog
Version | Description |
---|---|
2.4.0 | Introduced. |