| 1 | Index: wp-blog-header.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-blog-header.php (revision 2526) |
|---|
| 4 | +++ wp-blog-header.php (working copy) |
|---|
| 5 | @@ -85,7 +85,7 @@ |
|---|
| 6 | } |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | -$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup'); |
|---|
| 10 | +$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup','custom_key','custom_val'); |
|---|
| 11 | |
|---|
| 12 | $wpvarstoreset = apply_filters('query_vars', $wpvarstoreset); |
|---|
| 13 | |
|---|
| 14 | Index: wp-includes/classes.php |
|---|
| 15 | =================================================================== |
|---|
| 16 | --- wp-includes/classes.php (revision 2526) |
|---|
| 17 | +++ wp-includes/classes.php (working copy) |
|---|
| 18 | @@ -21,6 +21,8 @@ |
|---|
| 19 | var $is_time = false; |
|---|
| 20 | var $is_author = false; |
|---|
| 21 | var $is_category = false; |
|---|
| 22 | + var $is_customkey = false; |
|---|
| 23 | + var $is_customval = false; |
|---|
| 24 | var $is_search = false; |
|---|
| 25 | var $is_feed = false; |
|---|
| 26 | var $is_trackback = false; |
|---|
| 27 | @@ -40,6 +42,8 @@ |
|---|
| 28 | $this->is_time = false; |
|---|
| 29 | $this->is_author = false; |
|---|
| 30 | $this->is_category = false; |
|---|
| 31 | + $this->is_customkey = false; |
|---|
| 32 | + $this->is_customval = false; |
|---|
| 33 | $this->is_search = false; |
|---|
| 34 | $this->is_feed = false; |
|---|
| 35 | $this->is_trackback = false; |
|---|
| 36 | @@ -170,6 +174,14 @@ |
|---|
| 37 | if ( ($this->is_date || $this->is_author || $this->is_category)) { |
|---|
| 38 | $this->is_archive = true; |
|---|
| 39 | } |
|---|
| 40 | + |
|---|
| 41 | + if ('' != $qv['custom_key']) { |
|---|
| 42 | + $this->is_customkey = true; |
|---|
| 43 | + } |
|---|
| 44 | + |
|---|
| 45 | + if ('' != $qv['custom_val']) { |
|---|
| 46 | + $this->is_customval = true; |
|---|
| 47 | + } |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | if ('' != $qv['feed']) { |
|---|
| 51 | @@ -416,6 +428,39 @@ |
|---|
| 52 | $whichcat .= ")"; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | + // custom_key/custom_val stuff |
|---|
| 56 | + |
|---|
| 57 | + if ('' != $q['custom_key'] || '' != $q['custom_val']) { |
|---|
| 58 | + // can only add join statement once, so custom_key and custom_val are combined in one conditional. |
|---|
| 59 | + if (stristr($q['custom_key'],'/')) { |
|---|
| 60 | + $q['custom_key'] = explode('/',$q['custom_key']); |
|---|
| 61 | + if ($q['custom_key'][count($q['custom_key'])-1]) { |
|---|
| 62 | + $q['custom_key'] = $q['custom_key'][count($q['custom_key'])-1]; // no trailing slash |
|---|
| 63 | + } else { |
|---|
| 64 | + $q['custom_key'] = $q['custom_key'][count($q['custom_key'])-2]; // there was a trailling slash |
|---|
| 65 | + } |
|---|
| 66 | + } |
|---|
| 67 | + if (stristr($q['custom_val'],'/')) { |
|---|
| 68 | + $q['custom_val'] = explode('/',$q['custom_val']); |
|---|
| 69 | + if ($q['custom_val'][count($q['custom_val'])-1]) { |
|---|
| 70 | + $q['custom_val'] = $q['custom_val'][count($q['custom_val'])-1]; // no trailing slash |
|---|
| 71 | + } else { |
|---|
| 72 | + $q['custom_val'] = $q['custom_val'][count($q['custom_val'])-2]; // there was a trailling slash |
|---|
| 73 | + } |
|---|
| 74 | + } |
|---|
| 75 | + $q['custom_key'] = sanitize_title($q['custom_key']); |
|---|
| 76 | + $q['custom_val'] = sanitize_title($q['custom_val']); |
|---|
| 77 | + $tables .= ", $wpdb->postmeta"; |
|---|
| 78 | + $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) "; |
|---|
| 79 | + if ('' != $q['custom_key']) { |
|---|
| 80 | + $where .= " AND ($wpdb->postmeta.meta_key = '" . $q['custom_key'] . "')"; |
|---|
| 81 | + } |
|---|
| 82 | + if ('' != $q['custom_val']) { |
|---|
| 83 | + $where .= " AND ($wpdb->postmeta.meta_value = '" . $q['custom_val'] . "')"; |
|---|
| 84 | + } |
|---|
| 85 | + } |
|---|
| 86 | + |
|---|
| 87 | + |
|---|
| 88 | // Author/user stuff |
|---|
| 89 | |
|---|
| 90 | if ((empty($q['author'])) || ($q['author'] == '0')) { |
|---|
| 91 | @@ -1290,4 +1335,4 @@ |
|---|
| 92 | $wp_rewrite = new WP_Rewrite(); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | -?> |
|---|
| 96 | \ No newline at end of file |
|---|
| 97 | +?> |
|---|