Skip to content

Commit

Permalink
Masterbar: Updates based on latest Masterbar module changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fgiannar committed May 29, 2024
1 parent de2ac65 commit a2b5a0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ public function sort_hidden_submenus() {
global $submenu;

foreach ( $submenu as $menu_slug => $submenu_items ) {
if ( ! $submenu_items ) {
continue;
}

foreach ( $submenu_items as $submenu_index => $submenu_item ) {
if ( $this->is_item_visible( $submenu_item ) ) {
continue;
Expand Down
7 changes: 2 additions & 5 deletions projects/packages/masterbar/src/masterbar/class-masterbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,18 +987,15 @@ public function add_my_sites_submenu( $wp_admin_bar ) {
$blog_name = mb_substr( html_entity_decode( $blog_name, ENT_QUOTES ), 0, 20 ) . '…';
}

$my_site_url = 'https://wordpress.com/sites/' . $this->primary_site_url;
$my_site_title = _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack-masterbar' );
$my_site_url = 'https://wordpress.com/sites/' . $this->primary_site_url;
if ( 'wp-admin' === get_option( 'wpcom_admin_interface' ) ) {
$my_site_url = 'https://wordpress.com/sites';
$my_site_title = esc_html__( 'My Sites', 'jetpack-masterbar' );
$my_site_url = 'https://wordpress.com/sites';
}

$wp_admin_bar->add_menu(
array(
'parent' => 'root-default',
'id' => 'blog',
'title' => $my_site_title,
'href' => $my_site_url,
'meta' => array(
'class' => 'my-sites mb-trackable',
Expand Down
5 changes: 5 additions & 0 deletions projects/packages/masterbar/src/masterbar/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
min-height: unset !important;
}

/* Remove margin between icon and text since the my-sites menu does not have text */
#wpadminbar .my-sites .ab-item:before {
margin-right: 0;
}

/* Overwrite a core style which breaks the overflow for .my-sites in Safari */
#wpadminbar li.menupop.my-sites {
overflow: visible;
Expand Down

0 comments on commit a2b5a0f

Please sign in to comment.