Modifying Admin Bar Menu in WordPress

Modifying Admin Bar Menu in WordPress
add_action( 'admin_bar_menu', 'add_links_to_admin_bar',999);

function add_links_to_admin_bar($admin_bar) {         
          $args = array(
                'parent' => 'site-name',
                'id'     => 'media-libray',
                'title'  => 'Media Library',
                'href'   => esc_url( admin_url( 'upload.php' ) ),
                'meta'   => false
       		);
       	$admin_bar->add_node( $args );
       
        	$args = array(
        		'parent' => 'site-name',
        		'id'     => 'plugins',
        		'title'  => 'Plugins',
        		'href'   => esc_url( admin_url( 'plugins.php' ) ),
        		'meta'   => false
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'homes',
        		'title'  => 'Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=homes' ) ),
        		'meta'   => array('tabindex'=>10)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'avlhomes',
        		'title'  => 'Avalaible Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=available-homes' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'custhomes',
        		'title'  => 'Custom Homes',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=custom-homes' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );

        $args = array(
        		'parent' => 'site-name',
        		'id'     => 'community',
        		'title'  => 'Community',
        		'href'   => esc_url( admin_url( 'edit.php?post_type=community' ) ),
        		'meta'   => array('tabindex'=>12)
        	);
        $admin_bar->add_node( $args );
}

screen137

Leave a Reply

Your email address will not be published. Required fields are marked *