= 3.8) {
$title = '' . __('Edit Pages', 'bs_abep') . '';
$img = '';
} else {
$title = '
' . __('Edit Pages', 'bs_abep') . '';
$img = '_no_dashicon';
}
$admin_url = admin_url();
// Add the Parent link.
$wp_admin_bar->add_menu( array(
'title' => $title,
'href' => false,
'id' => 'bs_abep_links'.$img,
'href' => $admin_url.'edit.php?post_type=page'
));
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'meta_key' => '',
'meta_value' => '',
'authors' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
foreach ($pages as $page) {
if ($page->post_parent != 0){
$label = ' – '.ucwords($page->post_title);
$parent_id = $page->post_parent;
if ( ( count( get_post_ancestors($parent_id) ) ) >= 1 ) {
$label = ' '.$label;
}
} else {
$label = ucwords($page->post_title);
}
$page_id = $page->ID;
$url = get_edit_post_link($page_id);
$wp_admin_bar->add_menu( array(
'title' => $label,
'href' => $url,
'id' => $page_id,
'parent' => 'bs_abep_links'.$img
));
}
}
?>