Support timestamp permalinks. Make wider use of is_single(). Bug 0000194.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-07-28 02:43:54 +00:00
parent 487c3dbd66
commit 6b12e25d03
6 changed files with 17 additions and 9 deletions

View File

@ -149,7 +149,7 @@ update_category_cache();
$posts = query_posts($query_string);
if (1 == count($posts)) {
if ($p || $name) {
if (is_single()) {
$more = 1;
$single = 1;
}

View File

@ -65,6 +65,12 @@ class WP_Query_State {
$this->date = true;
}
// If year, month, day, hour, minute, and second are set, a single
// post is being queried.
if (('' != $hour) && ('' != $minute) &&('' != $second) && ('' != $year) && ('' != $monthnum) && ('' != $day)) {
$this->single = true;
}
if (!empty($s)) {
$this->search = true;
}

View File

@ -1248,7 +1248,8 @@ function generate_rewrite_rules($permalink_structure = '', $matches = '') {
$feedquery = $feedindex . '?' . $query . '&feed=' . preg_index($num_toks + 1, $matches);
$post = 0;
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')) {
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
|| (strstr($struct, '%year%') && strstr($struct, '%monthnum%') && strstr($struct, '%day%') && strstr($struct, '%hour%') && strstr($struct, '%minute') && strstr($struct, '%second%'))) {
$post = 1;
$trackbackmatch = $match . $trackbackregex;
$trackbackquery = $trackbackindex . '?' . $query . '&tb=1';

View File

@ -17,9 +17,9 @@ add_filter('comment_text', 'convert_smilies', 20);
add_filter('comment_excerpt', 'convert_chars');
function comments_template() {
global $withcomments, $single, $post, $wpdb, $id, $comment, $cookiehash;
global $withcomments, $post, $wpdb, $id, $comment, $cookiehash;
if ( $single || $withcomments ) :
if ( is_single() || $withcomments ) :
$req = get_settings('require_name_email');
$comment_author = isset($_COOKIE['comment_author_'.$cookiehash]) ? trim(stripslashes($_COOKIE['comment_author_'.$cookiehash])) : '';
$comment_author_email = isset($_COOKIE['comment_author_email_'.$cookiehash]) ? trim(stripslashes($_COOKIE['comment_author_email_'.$cookiehash])) : '';
@ -71,8 +71,9 @@ function comments_popup_script($width=400, $height=400, $file='wp-comments-popup
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash;
global $querystring_start, $querystring_equal, $querystring_separator;
global $comment_count_cache, $single;
if (!$single) {
global $comment_count_cache;
if (! is_single()) {
if ('' == $comment_count_cache["$id"]) {
$number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
} else {

View File

@ -98,7 +98,7 @@ function get_bloginfo($show='') {
function wp_title($sep = '»', $display = true) {
global $wpdb;
global $m, $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single;
global $m, $year, $monthnum, $day, $cat, $p, $name, $month, $posts;
// If there's a category
if(!empty($cat)) {
@ -128,7 +128,7 @@ function wp_title($sep = '»', $display = true) {
}
// If there's a post
if ($single) {
if (is_single()) {
$title = strip_tags($posts[0]->post_title);
$title = apply_filters('single_post_title', $title);
}

View File

@ -15,7 +15,7 @@ if (! $doing_trackback) {
require('wp-blog-header.php');
}
if ( (($p != '') && ($p != 'all')) || ($name != '') ) {
if (is_single()) {
$tb_id = $posts[0]->ID;
}