Changeset 13774 for trunk/wp-includes/query.php
- Timestamp:
- 03/20/2010 02:23:52 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r13770 r13774 1713 1713 $where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'"; 1714 1714 1715 if ('' != $q['name']) { 1715 if ( !empty($q['post_type']) && !empty($q[ $q['post_type'] ]) ) { 1716 $q[ $q['post_type'] ] = str_replace('%2F', '/', urlencode(urldecode($q[ $q['post_type'] ]))); 1717 $post_type_object = get_post_type_object($q['post_type']); 1718 if ( ! $post_type_object->hierarchical || strpos($q[ $q['post_type'] ], '/') === false) { 1719 $q['name'] = $q[ $q['post_type'] ] = sanitize_title($q[ $q['post_type'] ]); 1720 $where .= " AND $wpdb->posts.post_name = '" . $q[ $q['post_type'] ] . "'"; 1721 } else { 1722 // Hierarchical post type, need to look deeper to see if its an attachment or this post_type 1723 if ( isset($this->queried_object_id) ) { 1724 $reqpage = $this->queried_object_id; 1725 } else { 1726 $reqpage = get_page_by_path($q[ $q['post_type'] ], OBJECT, $q['post_type']); 1727 if ( !empty($reqpage) ) 1728 $reqpage = $reqpage->ID; 1729 else 1730 $reqpage = 0; 1731 } 1732 $where .= " AND ($wpdb->posts.ID = '$reqpage')"; 1733 $reqpage_obj = get_page($reqpage); 1734 if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) { 1735 $this->is_attachment = true; 1736 $q['attachment_id'] = $reqpage; 1737 $post_type = $q['post_type'] = 'attachment'; 1738 } 1739 } 1740 } elseif ( '' != $q['name'] ) { 1716 1741 $q['name'] = sanitize_title($q['name']); 1717 1742 $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'"; 1718 } else if ('' != $q['pagename']) {1743 } elseif ( '' != $q['pagename'] ) { 1719 1744 if ( isset($this->queried_object_id) ) 1720 1745 $reqpage = $this->queried_object_id; … … 1728 1753 1729 1754 $page_for_posts = get_option('page_for_posts'); 1730 if ( ('page' != get_option('show_on_front') ) || 1755 if ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) { 1731 1756 $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); 1732 1757 $page_paths = '/' . trim($q['pagename'], '/');
Note: See TracChangeset
for help on using the changeset viewer.