mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Add pagename query var.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da4a0d988e
commit
4a0112f746
@ -50,7 +50,7 @@ if ( !empty( $_SERVER['PATH_INFO'] ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static');
|
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename');
|
||||||
|
|
||||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||||
$wpvar = $wpvarstoreset[$i];
|
$wpvar = $wpvarstoreset[$i];
|
||||||
|
@ -220,8 +220,15 @@ class WP_Query {
|
|||||||
if ('' != $q['name']) {
|
if ('' != $q['name']) {
|
||||||
$q['name'] = preg_replace('/[^a-z0-9-_]/', '', $q['name']);
|
$q['name'] = preg_replace('/[^a-z0-9-_]/', '', $q['name']);
|
||||||
$where .= " AND post_name = '" . $q['name'] . "'";
|
$where .= " AND post_name = '" . $q['name'] . "'";
|
||||||
|
} else if ('' != $q['pagename']) {
|
||||||
|
// If pagename is set, set static to true and set name to pagename.
|
||||||
|
$q['pagename'] = preg_replace('/[^a-z0-9-_]/', '', $q['pagename']);
|
||||||
|
$q['name'] = $q['pagename'];
|
||||||
|
$q['static'] = true;
|
||||||
|
$where .= " AND post_name = '" . $q['pagename'] . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ('' != $q['w']) {
|
if ('' != $q['w']) {
|
||||||
$q['w'] = ''.intval($q['w']);
|
$q['w'] = ''.intval($q['w']);
|
||||||
$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";
|
$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";
|
||||||
|
@ -1204,8 +1204,8 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
|
|||||||
'%second%',
|
'%second%',
|
||||||
'%postname%',
|
'%postname%',
|
||||||
'%post_id%',
|
'%post_id%',
|
||||||
'%category%',
|
'%category%',
|
||||||
'%author%',
|
'%author%',
|
||||||
'%pagename%'
|
'%pagename%'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1234,9 +1234,9 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
|
|||||||
'second=',
|
'second=',
|
||||||
'name=',
|
'name=',
|
||||||
'p=',
|
'p=',
|
||||||
'category_name=',
|
'category_name=',
|
||||||
'author_name=',
|
'author_name=',
|
||||||
'static=1&name=',
|
'pagename=',
|
||||||
);
|
);
|
||||||
|
|
||||||
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';
|
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';
|
||||||
|
@ -34,9 +34,9 @@ function get_permalink($id=false) {
|
|||||||
'%year%',
|
'%year%',
|
||||||
'%monthnum%',
|
'%monthnum%',
|
||||||
'%day%',
|
'%day%',
|
||||||
'%hour%',
|
'%hour%',
|
||||||
'%minute%',
|
'%minute%',
|
||||||
'%second%',
|
'%second%',
|
||||||
'%postname%',
|
'%postname%',
|
||||||
'%post_id%',
|
'%post_id%',
|
||||||
'%category%',
|
'%category%',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user