wp_admin_bar_edit_menu [ WordPress Function ]
wp_admin_bar_edit_menu ( $wp_admin_bar )
| Defined at: |
|
Soorgelijke functies: wp_admin_bar_site_menu, wp_admin_bar_wp_menu, wp_admin_bar_updates_menu, wp_admin_bar_my_sites_menu, wp_admin_bar_search_menu
Provide an edit link for posts and terms.
Source
<?php
function wp_admin_bar_edit_menu( $wp_admin_bar ) {
global $post, $tag, $wp_the_query;
if ( is_admin() ) {
$current_screen = get_current_screen();
if ( 'post' == $current_screen->base
&& 'add' != $current_screen->action
&& ( $post_type_object = get_post_type_object( $post->post_type ) )
&& current_user_can( $post_type_object->cap->read_post, $post->ID )
&& ( $post_type_object->public ) )
{
$wp_admin_bar->add_menu( array(
'id' => 'view',
'title' => $post_type_object->labels->view_item,
'href' => get_permalink( $post->ID )
) );
} elseif ( 'edit-tags' == $current_screen->base
&& isset( $tag ) && is_object( $tag )
&& ( $tax = get_taxonomy( $tag->taxonomy ) )
&& $tax->public )
{
$wp_admin_bar->add_menu( array(
'id' => 'view',
'title' => $tax->labels->view_item,
'href' => get_term_link( $tag )
) );
}
} else {
$current_object = $wp_the_query->get_queried_object();
if ( empty( $current_object ) )
return;
if ( ! empty( $current_object->post_type )
&& ( $post_type_object = get_post_type_object( $current_object->post_type ) )
&& current_user_can( $post_type_object->cap->edit_post, $current_object->ID )
&& ( $post_type_object->show_ui || 'attachment' == $current_object->post_type ) )
{
$wp_admin_bar->add_menu( array(
'id' => 'edit',
'title' => $post_type_object->labels->edit_item,
'href' => get_edit_post_link( $current_object->ID )
) );
} elseif ( ! empty( $current_object->taxonomy )
&& ( $tax = get_taxonomy( $current_object->taxonomy ) )
&& current_user_can( $tax->cap->edit_terms )
&& $tax->show_ui )
{
$wp_admin_bar->add_menu( array(
'id' => 'edit',
'title' => $tax->labels->edit_item,
'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy )
) );
}
}
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- WordPress 3.1 Admin Bar - WP Engineer
Sep 27, 2010... 50 ); remove_action( 'wp_before_admin_bar_render', ' wp_admin_bar_edit_menu', 100 ); remove_action( 'wp_head', ' wp_admin_bar_css' ) ...
wpengineer.com - wp-includes/class-wp-admin-bar.php source
... 60 ); 465 add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu' , 70 ); 466 } 467 add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', ...
phpxref.ftwr.co.uk - PHPXRef 0.7 : WordPress : Detail view of admin-bar.php
wp_admin_bar_shortlink_menu() wp_admin_bar_edit_menu() ...
phpxref.ftwr.co.uk - admin-bar.php - PHP Cross Reference of WordPress Source - Yoast
wp_admin_bar_shortlink_menu() wp_admin_bar_edit_menu() ...
xref.yoast.com