Add filter for the args into wp_dropdown_pages() in the page attributes box. Give the list_pages filter the context of the post object. fixes #8592 for 3.3.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-09-29 21:21:15 +00:00
parent a418189fe2
commit 3440dbb182
3 changed files with 22 additions and 3 deletions

View File

@ -846,7 +846,15 @@ class WP_Posts_List_Table extends WP_List_Table {
<label>
<span class="title"><?php _e( 'Parent' ); ?></span>
<?php
$dropdown_args = array( 'post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __( 'Main Page (no parent)' ), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title' );
$dropdown_args = array(
'post_type' => $post_type_object->name,
'selected' => $post->post_parent,
'name' => 'post_parent',
'show_option_none' => __( 'Main Page (no parent)' ),
'option_none_value' => 0,
'sort_column' => 'menu_order, post_title',
);
if ( $bulk )
$dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );

View File

@ -560,7 +560,18 @@ function post_revisions_meta_box($post) {
function page_attributes_meta_box($post) {
$post_type_object = get_post_type_object($post->post_type);
if ( $post_type_object->hierarchical ) {
$pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));
$dropdown_args = array(
'post_type' => $post->post_type,
'exclude_tree' => $post->ID,
'selected' => $post->post_parent,
'name' => 'parent_id',
'show_option_none' => __('(no parent)'),
'sort_column' => 'menu_order, post_title',
'echo' => 0,
);
$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
$pages = wp_dropdown_pages( $dropdown_args );
if ( ! empty($pages) ) {
?>
<p><strong><?php _e('Parent') ?></strong></p>

View File

@ -1107,7 +1107,7 @@ class Walker_PageDropdown extends Walker {
if ( $page->ID == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$title = apply_filters( 'list_pages', $page->post_title );
$title = apply_filters( 'list_pages', $page->post_title, $page );
$output .= $pad . esc_html( $title );
$output .= "</option>\n";
}