Changeset 3655 for trunk/wp-includes/template-functions-post.php
- Timestamp:
- 03/21/2006 04:26:50 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/template-functions-post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-post.php
r3644 r3655 307 307 308 308 $defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 309 'hierarchical' => 1 );309 'hierarchical' => 1, $exclude => '', $include => ''); 310 310 $r = array_merge($defaults, $r); 311 extract($r); 312 313 $inclusions = ''; 314 if ( !empty($include) ) { 315 $child_of = 0; //ignore child_of and exclude params if using include 316 $exclude = ''; 317 $incpages = preg_split('/[\s,]+/',$include); 318 if ( count($incpages) ) { 319 foreach ( $incpages as $incpage ) { 320 if (empty($inclusions)) 321 $inclusions = ' AND ( ID = ' . intval($incpage) . ' '; 322 else 323 $inclusions .= ' OR ID = ' . intval($incpage) . ' '; 324 } 325 } 326 } 327 if (!empty($inclusions)) 328 $inclusions .= ')'; 311 329 312 330 $exclusions = ''; 313 if ( !empty($ r['exclude']) ) {314 $expages = preg_split('/[\s,]+/',$ r['exclude']);331 if ( !empty($exclude) ) { 332 $expages = preg_split('/[\s,]+/',$exclude); 315 333 if ( count($expages) ) { 316 334 foreach ( $expages as $expage ) { 317 $exclusions .= ' AND ID <> ' . intval($expage) . ' '; 335 if (empty($exclusions)) 336 $exclusions = ' AND ( ID <> ' . intval($expage) . ' '; 337 else 338 $exclusions .= ' AND ID <> ' . intval($expage) . ' '; 318 339 } 319 340 } 320 341 } 342 if (!empty($exclusions)) 343 $exclusions .= ')'; 321 344 322 345 $pages = $wpdb->get_results("SELECT * " . 323 346 "FROM $wpdb->posts " . 324 347 "WHERE post_type = 'page' AND post_status = 'publish' " . 325 "$exclusions " .326 "ORDER BY " . $ r['sort_column'] . " " . $r['sort_order']);348 "$exclusions $inclusions" . 349 "ORDER BY " . $sort_column . " " . $sort_order); 327 350 328 351 if ( empty($pages) ) … … 332 355 update_page_cache($pages); 333 356 334 if ( $ r['child_of'] || $r['hierarchical'])335 $pages = & get_page_children($ r['child_of'], $pages);357 if ( $child_of || $hierarchical ) 358 $pages = & get_page_children($child_of, $pages); 336 359 337 360 return $pages;
Note:
See TracChangeset
for help on using the changeset viewer.