changed the permalink dates to output leading zeros
git-svn-id: https://develop.svn.wordpress.org/trunk@773 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dd8ca7bc6a
commit
80cc201c56
|
@ -92,7 +92,7 @@ if ($monthnum != '') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($day != '') {
|
if ($day != '') {
|
||||||
$hay = '' . intval($day);
|
$day = '' . intval($day);
|
||||||
$where .= ' AND DAYOFMONTH(post_date)=' . $day;
|
$where .= ' AND DAYOFMONTH(post_date)=' . $day;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ function get_bloginfo($show='') {
|
||||||
|
|
||||||
function wp_title($sep = '»', $display = true) {
|
function wp_title($sep = '»', $display = true) {
|
||||||
global $wpdb, $tableposts, $tablecategories;
|
global $wpdb, $tableposts, $tablecategories;
|
||||||
global $year, $monthnum, $day, $cat, $p, $name;
|
global $year, $monthnum, $day, $cat, $p, $name, $month;
|
||||||
|
|
||||||
// If there's a category
|
// If there's a category
|
||||||
if(!empty($cat)) {
|
if(!empty($cat)) {
|
||||||
|
@ -97,10 +97,10 @@ function wp_title($sep = '»', $display = true) {
|
||||||
if (!empty($year)) {
|
if (!empty($year)) {
|
||||||
$title = $year;
|
$title = $year;
|
||||||
if (!empty($monthnum)) {
|
if (!empty($monthnum)) {
|
||||||
$title .= " $sep $monthnum";
|
$title .= " $sep ".$month[zeroise($monthnum, 2)];
|
||||||
}
|
}
|
||||||
if (!empty($day)) {
|
if (!empty($day)) {
|
||||||
$title .= " $sep $day";
|
$title .= " $sep ".zeroise($day, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ function wp_title($sep = '»', $display = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($day != '') {
|
if ($day != '') {
|
||||||
$hay = '' . intval($day);
|
$day = '' . intval($day);
|
||||||
$where .= ' AND DAYOFMONTH(post_date)=' . $day;
|
$where .= ' AND DAYOFMONTH(post_date)=' . $day;
|
||||||
}
|
}
|
||||||
$p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name' $where");
|
$p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name' $where");
|
||||||
|
@ -487,8 +487,8 @@ function get_permalink($id=false) {
|
||||||
$unixtime = strtotime($post->post_date);
|
$unixtime = strtotime($post->post_date);
|
||||||
$rewritereplace = array(
|
$rewritereplace = array(
|
||||||
date('Y', $unixtime),
|
date('Y', $unixtime),
|
||||||
date('n', $unixtime),
|
date('m', $unixtime),
|
||||||
date('j', $unixtime),
|
date('d', $unixtime),
|
||||||
$post->post_name,
|
$post->post_name,
|
||||||
$post->ID
|
$post->ID
|
||||||
);
|
);
|
||||||
|
@ -502,8 +502,8 @@ function get_permalink($id=false) {
|
||||||
$unixtime = strtotime($idpost->post_date);
|
$unixtime = strtotime($idpost->post_date);
|
||||||
$rewritereplace = array(
|
$rewritereplace = array(
|
||||||
date('Y', $unixtime),
|
date('Y', $unixtime),
|
||||||
date('n', $unixtime),
|
date('m', $unixtime),
|
||||||
date('j', $unixtime),
|
date('d', $unixtime),
|
||||||
$idpost->post_name,
|
$idpost->post_name,
|
||||||
$id
|
$id
|
||||||
);
|
);
|
||||||
|
@ -524,7 +524,7 @@ function get_month_link($year, $month) {
|
||||||
$monthlink = substr(get_settings('permalink_structure'), 0, $offset);
|
$monthlink = substr(get_settings('permalink_structure'), 0, $offset);
|
||||||
if ('/' != substr($monthlink, -1)) $monthlink = substr($monthlink, 0, -1);
|
if ('/' != substr($monthlink, -1)) $monthlink = substr($monthlink, 0, -1);
|
||||||
$monthlink = str_replace('%year%', $year, $monthlink);
|
$monthlink = str_replace('%year%', $year, $monthlink);
|
||||||
$monthlink = str_replace('%monthnum%', intval($month), $monthlink);
|
$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
|
||||||
$monthlink = str_replace('%post_id%', '', $monthlink);
|
$monthlink = str_replace('%post_id%', '', $monthlink);
|
||||||
return $siteurl . $monthlink;
|
return $siteurl . $monthlink;
|
||||||
} else {
|
} else {
|
||||||
|
@ -543,8 +543,8 @@ function get_day_link($year, $month, $day) {
|
||||||
$daylink = substr(get_settings('permalink_structure'), 0, $offset);
|
$daylink = substr(get_settings('permalink_structure'), 0, $offset);
|
||||||
if ('/' != substr($daylink, -1)) $daylink = substr($daylink, 0, -1);
|
if ('/' != substr($daylink, -1)) $daylink = substr($daylink, 0, -1);
|
||||||
$daylink = str_replace('%year%', $year, $daylink);
|
$daylink = str_replace('%year%', $year, $daylink);
|
||||||
$daylink = str_replace('%monthnum%', intval($month), $daylink);
|
$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
|
||||||
$daylink = str_replace('%day%', intval($day), $daylink);
|
$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
|
||||||
$daylink = str_replace('%post_id%', '', $daylink);
|
$daylink = str_replace('%post_id%', '', $daylink);
|
||||||
return $siteurl . $daylink;
|
return $siteurl . $daylink;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue