Add custom links to wp admin toolbar
Add custom links to wp admin toolbar.
(don’t forget to fix the href link for the items. you have to put the [get_admin_url() .] outside of the quotes)
// Add Toolbar Menus
function custom_toolbar() {
global $wp_admin_bar;
$args = array(
'id' => 'editar-secoes',
'title' => __( 'Editar Seções', 'text_domain' ),
);
$wp_admin_bar->add_menu( $args );
$args = array(
'id' => 'secao-servicos',
'parent' => 'editar-secoes',
'title' => __( 'Serviços', 'text_domain' ),
'href' => 'get_admin_url() . post.php?post=19&action=edit',
);
$wp_admin_bar->add_menu( $args );
$args = array(
'id' => 'secao-sobre',
'parent' => 'editar-secoes',
'title' => __( 'Sobre', 'text_domain' ),
'href' => 'get_admin_url() . post.php?post=21&action=edit',
);
$wp_admin_bar->add_menu( $args );
$args = array(
'id' => 'secao-equipe',
'parent' => 'editar-secoes',
'title' => __( 'Equipe', 'text_domain' ),
'href' => 'get_admin_url() . post.php?post=23&action=edit',
);
$wp_admin_bar->add_menu( $args );
$args = array(
'id' => 'secao-trabalhos',
'parent' => 'editar-secoes',
'title' => __( 'Trabalhos', 'text_domain' ),
'href' => 'get_admin_url() . edit.php?post_type=job',
);
$wp_admin_bar->add_menu( $args );
}
add_action( 'wp_before_admin_bar_render', 'custom_toolbar', 999 );