Sometimes I lie awake at night,and I ask,“Where have I gone wrong?” Then a voice says to me,“This is going to take more than one night.”.
- Charlie Brown
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | // Category stuff if ((empty($q['cat'])) || ($q['cat'] == '0') || // Bypass cat checks if fetching specific posts ( $this->is_single || $this->is_page )) { $whichcat=''; } else { $q['cat'] = ''.urldecode($q['cat']).''; $q['cat'] = addslashes_gpc($q['cat']); $join = "LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) "; $cat_array = preg_split('/[,\s]+/', $q['cat']); $in_cats = $out_cats = ''; foreach ( $cat_array as $cat ) { $in = strstr($cat, '-') ? false : true; $cat = trim($cat, '-'); if ( $in ) $in_cats .= "$cat," . get_category_children($cat, '', ','); else $out_cats .= "$cat," . get_category_children($cat, '', ','); } $in_cats = substr($in_cats, 0, -2); $out_cats = substr($out_cats, 0, -2); if ( strlen($in_cats) > 0 ) $in_cats = "AND category_id IN ($in_cats)"; if ( strlen($out_cats) > 0 ) $out_cats = "AND category_id NOT IN ($out_cats)"; $whichcat = $in_cats . $out_cats; $distinct = 'DISTINCT'; } // Category stuff for nice URIs global $cache_categories; if ('' != $q['category_name']) { |
If you enjoyed this post,make sure you subscribe to my RSS feed!



[...] More Than One Night [...]