Changeset 5444 for trunk/wp-includes/post.php
- Timestamp:
- 05/11/2007 03:10:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5271 r5444 28 28 function &get_children($args = '', $output = OBJECT) { 29 29 global $post_cache, $wpdb, $blog_id; 30 31 if ( empty( $args) ) {32 if ( isset( $GLOBALS['post']) )33 $ r = array('post_parent' => & $GLOBALS['post']->post_parent);34 else30 31 if ( empty( $args ) ) { 32 if ( isset( $GLOBALS['post'] ) ) { 33 $args = 'post_parent=' . (int) $GLOBALS['post']->post_parent; 34 } else { 35 35 return false; 36 } elseif ( is_object($args) ) 37 $r = array('post_parent' => $post->post_parent); 38 elseif ( is_numeric($args) ) 39 $r = array('post_parent' => $args); 40 elseif ( is_array($args) ) 41 $r = &$args; 42 else 43 parse_str($args, $r); 44 45 $defaults = array('numberposts' => -1, 'post_type' => '', 'post_status' => '', 'post_parent' => 0); 46 $r = array_merge($defaults, $r); 36 } 37 } elseif ( is_object( $args ) ) { 38 $args = 'post_parent=' . (int) $args->post_parent; 39 } elseif ( is_numeric( $args ) ) { 40 $args = 'post_parent=' . (int) $args; 41 } 42 43 $defaults = array( 44 'numberposts' => -1, 'post_type' => '', 45 'post_status' => '', 'post_parent' => 0 46 ); 47 48 $r = wp_parse_args( $args, $defaults ); 47 49 48 50 $children = get_posts( $r ); … … 173 175 function get_posts($args) { 174 176 global $wpdb; 175 176 if ( is_array($args) ) 177 $r = &$args; 178 else 179 parse_str($args, $r); 180 181 $defaults = array('numberposts' => 5, 'offset' => 0, 'category' => 0, 182 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 183 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'post', 'post_status' => 'publish', 'post_parent' => 0); 184 $r = array_merge($defaults, $r); 185 extract($r); 177 178 $defaults = array( 179 'numberposts' => 5, 'offset' => 0, 180 'category' => 0, 'orderby' => 'post_date', 181 'order' => 'DESC', 'include' => '', 182 'exclude' => '', 'meta_key' => '', 183 'meta_value' =>'', 'post_type' => 'post', 184 'post_status' => 'publish', 'post_parent' => 0 185 ); 186 187 $r = wp_parse_args( $args, $defaults ); 188 extract( $r ); 189 186 190 $numberposts = (int) $numberposts; 187 191 $offset = (int) $offset; … … 1164 1168 function &get_pages($args = '') { 1165 1169 global $wpdb; 1166 1167 if ( is_array($args) ) 1168 $r = &$args; 1169 else 1170 parse_str($args, $r); 1171 1172 $defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 1173 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => ''); 1174 $r = array_merge($defaults, $r); 1175 extract($r); 1170 1171 $defaults = array( 1172 'child_of' => 0, 'sort_order' => 'ASC', 1173 'sort_column' => 'post_title', 'hierarchical' => 1, 1174 'exclude' => '', 'include' => '', 1175 'meta_key' => '', 'meta_value' => '', 1176 'authors' => '' 1177 ); 1178 1179 $r = wp_parse_args( $args, $defaults ); 1180 extract( $r ); 1176 1181 1177 1182 $key = md5( serialize( $r ) );
Note: See TracChangeset
for help on using the changeset viewer.