Add Dropdown Pages Links to WordPress Admin Bar

With this script you will have quick access to all the pages right from WordPress Admin Bar

Scripts Organizer Settings

add dropdown pages links to wordpress admin bar

Code

<?php /* ** Add Dropdown Pages Links to WordPress Admin Bar */ // Add Parent Link function dplugins_toolbar_page_links($wp_admin_bar) { $parent_menu_args = array( 'id' => 'dplugins-ct-pages', 'title' => 'Pages List', 'href' => site_url().'/wp-admin/edit.php?post_type=ct_template', 'meta' => array( 'class' => 'dplugins-ct-pages', 'title' => 'Pages List' ) ); $wp_admin_bar->add_node($parent_menu_args); // Add Pages List $ct_pages = get_posts(array( 'post_type' => 'page', 'posts_per_page' => -1, )); if($ct_pages){ foreach($ct_pages as $ct_page){ $ct_page_args = array( 'id' => 'dplugins-'.$ct_page->post_name, 'title' => $ct_page->post_title, 'href' => site_url().'/wp-admin/post.php?post='.$ct_page->ID.'&action=edit', 'parent' => 'dplugins-ct-pages', 'meta' => array( 'class' => 'dplugins-oxy-pages', 'title' => $ct_page->post_title, ) ); $wp_admin_bar->add_node($ct_page_args); } } } add_action('admin_bar_menu', 'dplugins_toolbar_page_links', 999);
Code language: HTML, XML (xml)

Marko Krstić

Owner of dPlugins. Started with design in 1999. Currently, besides dPlugins, he is an Art director at Scandic Hotels, delivering design for the Web and the App for 270 Scandinavian hotels.
flywheel grey
Great load time is only possible with powerful hosting. Purchase it  now.