From ff3d47b742ef17260a33d80013a6907aba2d9490 Mon Sep 17 00:00:00 2001 From: rboren Date: Fri, 8 Oct 2004 08:06:21 +0000 Subject: [PATCH] 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 --- wp-blog-header.php | 2 +- wp-includes/classes.php | 24 ++++++++++++++---------- wp-includes/template-functions-links.php | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/wp-blog-header.php b/wp-blog-header.php index f6bbe4fd9..3f98ede1a 100644 --- a/wp-blog-header.php +++ b/wp-blog-header.php @@ -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; $iis_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"'; diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 7f54b48eb..c28a0d7e6 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -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;