Changeset 10129
- Timestamp:
- 12/08/2008 07:29:42 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-page-form.php
r10094 r10129 271 271 <h5><?php _e('Parent') ?></h5> 272 272 <label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label> 273 <?php wp_dropdown_pages(array(' selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'))); ?>273 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'))); ?> 274 274 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how deeply nested you can make pages.'); ?></p> 275 275 <?php -
trunk/wp-includes/post.php
r10088 r10129 1418 1418 $post_parent = 0; 1419 1419 1420 if ( !empty($post_ID) ) { 1421 if ( $post_parent == $post_ID ) { 1422 // Post can't be its own parent 1423 $post_parent = 0; 1424 } elseif ( !empty($post_parent) ) { 1425 $parent_post = get_post($post_parent); 1426 // Check for circular dependency 1427 if ( $parent_post->post_parent == $post_ID ) 1428 $post_parent = 0; 1429 } 1430 } 1431 1420 1432 if ( isset($menu_order) ) 1421 1433 $menu_order = (int) $menu_order; … … 2060 2072 'exclude' => '', 'include' => '', 2061 2073 'meta_key' => '', 'meta_value' => '', 2062 'authors' => '', 'parent' => -1 2074 'authors' => '', 'parent' => -1, 'exclude_tree' => '' 2063 2075 ); 2064 2076 … … 2170 2182 if ( $child_of || $hierarchical ) 2171 2183 $pages = & get_page_children($child_of, $pages); 2184 2185 if ( !empty($exclude_tree) ) { 2186 $exclude = array(); 2187 2188 $exclude = (int) $exclude_tree; 2189 $children = get_page_children($exclude, $pages); 2190 $excludes = array(); 2191 foreach ( $children as $child ) 2192 $excludes[] = $child->ID; 2193 $excludes[] = $exclude; 2194 $total = count($pages); 2195 for ( $i = 0; $i < $total; $i++ ) { 2196 if ( in_array($pages[$i]->ID, $excludes) ) 2197 unset($pages[$i]); 2198 } 2199 } 2172 2200 2173 2201 $cache[ $key ] = $pages;
Note: See TracChangeset
for help on using the changeset viewer.