Allow category and date filtering to coincide. Allow any number of spaces or commas to serve as item separators in the category and author arrays. http://mosquito.wordpress.org/view.php?id=221
git-svn-id: https://develop.svn.wordpress.org/trunk@2295 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
eddeb9a3cb
commit
093d13ed1c
@ -353,11 +353,7 @@ class WP_Query {
|
||||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
// Bypass cat checks if fetching specific posts
|
||||
(
|
||||
intval($q['year']) || intval($q['monthnum']) || intval($q['day']) || intval($q['w']) ||
|
||||
intval($q['p']) || !empty($q['name']) || !empty($q['s'])
|
||||
)
|
||||
) {
|
||||
( is_single() || is_page() )) {
|
||||
$whichcat='';
|
||||
} else {
|
||||
$q['cat'] = ''.urldecode($q['cat']).'';
|
||||
@ -375,7 +371,7 @@ class WP_Query {
|
||||
$andor = 'OR';
|
||||
}
|
||||
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
|
||||
$cat_array = explode(' ',$q['cat']);
|
||||
$cat_array = preg_split('/[,\s]+/', $q['cat']);
|
||||
$whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
|
||||
$whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' ');
|
||||
for ($i = 1; $i < (count($cat_array)); $i = $i + 1) {
|
||||
@ -424,7 +420,7 @@ class WP_Query {
|
||||
$eq = '=';
|
||||
$andor = 'OR';
|
||||
}
|
||||
$author_array = explode(' ', $q['author']);
|
||||
$author_array = preg_split('/[,\s]+/', $q['author']);
|
||||
$whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]);
|
||||
for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
|
||||
$whichauthor .= ' '.$andor.' post_author '.$eq.' '.intval($author_array[$i]);
|
||||
|
Loading…
Reference in New Issue
Block a user