Add pagename query var.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-08-11 01:55:34 +00:00
parent da4a0d988e
commit 4a0112f746
4 changed files with 16 additions and 9 deletions

View File

@ -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) {
$wpvar = $wpvarstoreset[$i];

View File

@ -220,8 +220,15 @@ class WP_Query {
if ('' != $q['name']) {
$q['name'] = preg_replace('/[^a-z0-9-_]/', '', $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']) {
$q['w'] = ''.intval($q['w']);
$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";

View File

@ -1204,8 +1204,8 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
'%second%',
'%postname%',
'%post_id%',
'%category%',
'%author%',
'%category%',
'%author%',
'%pagename%'
);
@ -1234,9 +1234,9 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
'second=',
'name=',
'p=',
'category_name=',
'author_name=',
'static=1&name=',
'category_name=',
'author_name=',
'pagename=',
);
$feedregex = '(feed|rdf|rss|rss2|atom)/?$';

View File

@ -34,9 +34,9 @@ function get_permalink($id=false) {
'%year%',
'%monthnum%',
'%day%',
'%hour%',
'%minute%',
'%second%',
'%hour%',
'%minute%',
'%second%',
'%postname%',
'%post_id%',
'%category%',