Changeset 6026 for trunk/wp-includes/post.php
- Timestamp:
- 09/03/2007 11:32:58 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5976 r6026 42 42 43 43 $defaults = array( 44 'numberposts' => -1, 'post_type' => '', 44 'numberposts' => -1, 'post_type' => '', 45 45 'post_status' => '', 'post_parent' => 0 46 46 ); … … 195 195 196 196 $defaults = array( 197 'numberposts' => 5, 'offset' => 0, 198 'category' => 0, 'orderby' => 'post_date', 199 'order' => 'DESC', 'include' => '', 200 'exclude' => '', 'meta_key' => '', 201 'meta_value' =>'', 'post_type' => 'post', 197 'numberposts' => 5, 'offset' => 0, 198 'category' => 0, 'orderby' => 'post_date', 199 'order' => 'DESC', 'include' => '', 200 'exclude' => '', 'meta_key' => '', 201 'meta_value' =>'', 'post_type' => 'post', 202 202 'post_status' => 'publish', 'post_parent' => 0 203 203 ); … … 249 249 250 250 $query = "SELECT DISTINCT * FROM $wpdb->posts "; 251 $query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy "; 251 $query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy "; 252 252 $query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta "; 253 253 $query .= " WHERE 1=1 "; … … 440 440 $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context); 441 441 else 442 $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); 442 $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); 443 443 } 444 444 … … 1115 1115 1116 1116 $defaults = array( 1117 'child_of' => 0, 'sort_order' => 'ASC', 1118 'sort_column' => 'post_title', 'hierarchical' => 1, 1119 'exclude' => '', 'include' => '', 1120 'meta_key' => '', 'meta_value' => '', 1117 'child_of' => 0, 'sort_order' => 'ASC', 1118 'sort_column' => 'post_title', 'hierarchical' => 1, 1119 'exclude' => '', 'include' => '', 1120 'meta_key' => '', 'meta_value' => '', 1121 1121 'authors' => '' 1122 1122 ); … … 1132 1132 $inclusions = ''; 1133 1133 if ( !empty($include) ) { 1134 $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 1134 $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include 1135 1135 $exclude = ''; 1136 1136 $meta_key = ''; … … 1161 1161 } 1162 1162 } 1163 if (!empty($exclusions)) 1163 if (!empty($exclusions)) 1164 1164 $exclusions .= ')'; 1165 1165 … … 1191 1191 1192 1192 $query = "SELECT * FROM $wpdb->posts " ; 1193 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 1193 $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ; 1194 1194 $query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ; 1195 1195 $query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ; … … 1622 1622 * to allow all published posts, and all private posts to which the user 1623 1623 * has access. 1624 * 1624 * 1625 1625 * @param string $post_type currently only supports 'post' or 'page'. 1626 1626 * @return string SQL code that can be added to a where clause.
Note: See TracChangeset
for help on using the changeset viewer.