Make WordPress Core


Ignore:
Timestamp:
02/13/2005 05:52:58 PM (22 years ago)
Author:
rboren
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r2261 r2295  
    354354                if ((empty($q['cat'])) || ($q['cat'] == '0') ||
    355355                                // Bypass cat checks if fetching specific posts
    356                                 (
    357                                  intval($q['year']) || intval($q['monthnum']) || intval($q['day']) || intval($q['w']) ||
    358                                  intval($q['p']) || !empty($q['name']) || !empty($q['s'])
    359                                  )
    360                                 ) {
     356                                ( is_single() || is_page() )) {
    361357                        $whichcat='';
    362358                } else {
     
    376372                        }
    377373                        $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
    378                         $cat_array = explode(' ',$q['cat']);
     374                        $cat_array = preg_split('/[,\s]+/', $q['cat']);
    379375                        $whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
    380376                        $whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' ');
     
    425421                                $andor = 'OR';
    426422                        }
    427                         $author_array = explode(' ', $q['author']);
     423                        $author_array = preg_split('/[,\s]+/', $q['author']);
    428424                        $whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]);
    429425                        for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
Note: See TracChangeset for help on using the changeset viewer.