Add pagename query var.

git-svn-id: https://develop.svn.wordpress.org/trunk@1531 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2004-08-11 01:55:34 +00:00
parent ba3fc2100c
commit 01b53facab
4 changed files with 16 additions and 9 deletions

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%',