rebase on oct-10-2023
This commit is contained in:
@@ -122,11 +122,14 @@ function wp_admin_bar_render() {
|
||||
*/
|
||||
function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||
if ( current_user_can( 'read' ) ) {
|
||||
$about_url = self_admin_url( 'about.php' );
|
||||
$about_url = self_admin_url( 'about.php' );
|
||||
$contribute_url = self_admin_url( 'contribute.php' );
|
||||
} elseif ( is_multisite() ) {
|
||||
$about_url = get_dashboard_url( get_current_user_id(), 'about.php' );
|
||||
$about_url = get_dashboard_url( get_current_user_id(), 'about.php' );
|
||||
$contribute_url = get_dashboard_url( get_current_user_id(), 'contribute.php' );
|
||||
} else {
|
||||
$about_url = false;
|
||||
$about_url = false;
|
||||
$contribute_url = false;
|
||||
}
|
||||
|
||||
$wp_logo_menu_args = array(
|
||||
@@ -159,6 +162,18 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( $contribute_url ) {
|
||||
// Add contribute link.
|
||||
$wp_admin_bar->add_node(
|
||||
array(
|
||||
'parent' => 'wp-logo',
|
||||
'id' => 'contribute',
|
||||
'title' => __( 'Get Involved' ),
|
||||
'href' => $contribute_url,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add WordPress.org link.
|
||||
$wp_admin_bar->add_node(
|
||||
array(
|
||||
@@ -419,9 +434,14 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @global string $_wp_current_template_id
|
||||
* @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
|
||||
*
|
||||
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
|
||||
*/
|
||||
function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
|
||||
global $_wp_current_template_id;
|
||||
|
||||
// Don't show if a block theme is not activated.
|
||||
if ( ! wp_is_block_theme() ) {
|
||||
return;
|
||||
@@ -436,7 +456,13 @@ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
|
||||
array(
|
||||
'id' => 'site-editor',
|
||||
'title' => __( 'Edit site' ),
|
||||
'href' => admin_url( 'site-editor.php' ),
|
||||
'href' => add_query_arg(
|
||||
array(
|
||||
'postType' => 'wp_template',
|
||||
'postId' => $_wp_current_template_id,
|
||||
),
|
||||
admin_url( 'site-editor.php' )
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1052,7 +1078,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||
array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'background',
|
||||
'title' => __( 'Background' ),
|
||||
'title' => _x( 'Background', 'custom background' ),
|
||||
'href' => admin_url( 'themes.php?page=custom-background' ),
|
||||
'meta' => array(
|
||||
'class' => 'hide-if-customize',
|
||||
@@ -1066,7 +1092,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||
array(
|
||||
'parent' => 'appearance',
|
||||
'id' => 'header',
|
||||
'title' => __( 'Header' ),
|
||||
'title' => _x( 'Header', 'custom image header' ),
|
||||
'href' => admin_url( 'themes.php?page=custom-header' ),
|
||||
'meta' => array(
|
||||
'class' => 'hide-if-customize',
|
||||
|
||||
Reference in New Issue
Block a user