mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Use page_id=xx instead of p=xx&static=1
git-svn-id: http://svn.automattic.com/wordpress/trunk@1759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
943351b556
commit
ff3d47b742
@ -79,7 +79,7 @@ if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
||||
}
|
||||
}
|
||||
|
||||
$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', 'error');
|
||||
$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', 'page_id', 'error');
|
||||
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
|
@ -65,6 +65,11 @@ class WP_Query {
|
||||
$this->is_single = true;
|
||||
}
|
||||
|
||||
if ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
|
||||
$this->is_page = true;
|
||||
$this->is_single = false;
|
||||
}
|
||||
|
||||
if ('' != $qv['second']) {
|
||||
$this->is_time = true;
|
||||
$this->is_date = true;
|
||||
@ -143,8 +148,8 @@ class WP_Query {
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
// single, date, and search override category.
|
||||
if ($this->is_single || $this->is_date || $this->is_search) {
|
||||
// single, page, date, and search override category.
|
||||
if ($this->is_single || $this->is_page || $this->is_date || $this->is_search) {
|
||||
$this->is_category = false;
|
||||
}
|
||||
|
||||
@ -162,11 +167,6 @@ class WP_Query {
|
||||
$this->is_feed = true;
|
||||
}
|
||||
|
||||
if ('' != $qv['static'] || '' != $qv['pagename']) {
|
||||
$this->is_page = true;
|
||||
$this->is_single = false;
|
||||
}
|
||||
|
||||
if ('404' == $qv['error']) {
|
||||
$this->is_404 = true;
|
||||
}
|
||||
@ -267,10 +267,8 @@ class WP_Query {
|
||||
$q['name'] = sanitize_title($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'] = sanitize_title($q['pagename']);
|
||||
$q['name'] = $q['pagename'];
|
||||
$q['static'] = true;
|
||||
$where .= " AND post_name = '" . $q['pagename'] . "'";
|
||||
}
|
||||
|
||||
@ -286,6 +284,12 @@ class WP_Query {
|
||||
$where = ' AND ID = '.$q['p'];
|
||||
}
|
||||
|
||||
if (($q['page_id'] != '') && ($q['page_id'] != 'all')) {
|
||||
$q['page_id'] = intval($q['page_id']);
|
||||
$q['p'] = $q['page_id'];
|
||||
$where = ' AND ID = '.$q['page_id'];
|
||||
}
|
||||
|
||||
// If a search pattern is specified, load the posts that match
|
||||
if (!empty($q['s'])) {
|
||||
$q['s'] = addslashes_gpc($q['s']);
|
||||
@ -455,7 +459,7 @@ class WP_Query {
|
||||
$distinct = 'DISTINCT';
|
||||
}
|
||||
|
||||
if ('' != $q['static']) {
|
||||
if (is_page()) {
|
||||
$where .= ' AND (post_status = "static"';
|
||||
} else {
|
||||
$where .= ' AND (post_status = "publish"';
|
||||
|
@ -96,7 +96,7 @@ function get_page_link($id = false) {
|
||||
$link = get_page_uri($id);
|
||||
$link = get_settings('home') . "/$link/";
|
||||
} else {
|
||||
$link = get_settings('home') . "/index.php?p=$id&static=1";
|
||||
$link = get_settings('home') . "/index.php?page_id=$id";
|
||||
}
|
||||
|
||||
return $link;
|
||||
|
Loading…
Reference in New Issue
Block a user