WordPress.org

Make WordPress Core

Changeset 14232


Ignore:
Timestamp:
04/25/2010 08:30:32 AM (8 years ago)
Author:
dd32
Message:

Hide Parent dropdown in Page-attributes metabox when no potential parents exist. Props sorich87. Fixes #12655

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r14099 r14232  
    520520    $post_type_object = get_post_type_object($post->post_type);
    521521    if ( $post_type_object->hierarchical ) {
     522        $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));
     523        if ( ! empty($pages) ) {
    522524?>
    523525<h5><?php _e('Parent') ?></h5>
    524526<label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label>
    525 <?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')); ?>
     527<?php echo $pages; ?>
    526528<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>
    527529<?php
     530        } // end empty pages check
    528531    } // end hierarchical check.
    529532    if ( 0 != count( get_page_templates() ) ) {
Note: See TracChangeset for help on using the changeset viewer.