WordPress.org

Make WordPress Core

Ticket #12655: page_attributes_meta_box_patch.diff

File page_attributes_meta_box_patch.diff, 1.4 KB (added by sorich87, 4 years ago)
  • meta-boxes.php

     
    521521function page_attributes_meta_box($post) { 
    522522        $post_type_object = get_post_type_object($post->post_type); 
    523523        if ( $post_type_object->hierarchical ) { 
     524 
     525        $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0)); 
     526                if ( ! empty($pages) ) { 
    524527?> 
    525528<h5><?php _e('Parent') ?></h5> 
    526529<label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label> 
    527 <?php wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?> 
     530<?php echo $pages; ?> 
    528531<p><?php _e('You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p> 
    529532<?php 
     533                } 
    530534        } // end hierarchical check. 
    531535        if ( 0 != count( get_page_templates() ) ) { 
    532536                $template = !empty($post->page_template) ? $post->page_template : false;