Skip to content

Instantly share code, notes, and snippets.

@davidfcarr
Created February 17, 2022 01:57
Show Gist options
  • Save davidfcarr/1d82884717cd9d2fcbfd60198543d16e to your computer and use it in GitHub Desktop.
Save davidfcarr/1d82884717cd9d2fcbfd60198543d16e to your computer and use it in GitHub Desktop.
<?php
function my_edit_site_menu($wp_admin_bar) {
$args = array(
'parent' => 'site-editor',
'id' => 'theme-header',
'title' => __('Header / Menu','twentytwentytwo-tm'),
'href' => admin_url('site-editor.php?postType=wp_template_part&postId=twentytwentytwo-tm%2F%2Fheader'),
'meta' => array( 'class' => 'twentytwentytwo-tm')
);
$wp_admin_bar->add_node( $args );
$args = array(
'parent' => 'site-editor',
'id' => 'theme-templates',
'title' => __('Templates','twentytwentytwo-tm'),
'href' => admin_url('site-editor.php?postType=wp_template'),
'meta' => array( 'class' => 'twentytwentytwo-tm')
);
$wp_admin_bar->add_node( $args );
$args = array(
'parent' => 'site-editor',
'id' => 'theme-template-parts',
'title' => __('Template Parts (header, footer, sidebar)','twentytwentytwo-tm'),
'href' => admin_url('site-editor.php?postType=wp_template_part'),
'meta' => array( 'class' => 'twentytwentytwo-tm')
);
$wp_admin_bar->add_node( $args );
}
add_action( 'admin_bar_menu', 'my_edit_site_menu', 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment