Alpha functionality of new permalink structure as per previous discussions.
git-svn-id: http://svn.automattic.com/wordpress/trunk@470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1405,6 +1405,29 @@ function trackback_rdf($timezone = 0) {
|
||||
|
||||
|
||||
/***** Permalink tags *****/
|
||||
function get_permalink($id=false) {
|
||||
global $post;
|
||||
if (!$id) {
|
||||
if (get_settings('permalink_structure')) {
|
||||
$unixtime = strtotime($post->post_date);
|
||||
$rewritecode = array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
'%day%',
|
||||
'%postname%'
|
||||
);
|
||||
$rewritereplace = array(
|
||||
date('Y', $unixtime),
|
||||
date('n', $unixtime),
|
||||
date('j', $unixtime),
|
||||
$post->post_name
|
||||
);
|
||||
return str_replace($rewritecode, $rewritereplace, get_settings('permalink_structure'));
|
||||
} else { // if they're not using the fancy permalink option
|
||||
return $file.$querystring_start.'p'.$querystring_equal.$post->ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function permalink_anchor($mode = 'id') {
|
||||
global $id, $post;
|
||||
@@ -1434,25 +1457,7 @@ function permalink_link($file='', $mode = 'id') {
|
||||
$anchor = $id;
|
||||
break;
|
||||
}
|
||||
$archive_mode = get_settings('archive_mode');
|
||||
switch($archive_mode) {
|
||||
case 'daily':
|
||||
echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).substr($postdata['Date'],8,2).'#post-'.$anchor;
|
||||
break;
|
||||
case 'monthly':
|
||||
echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).'#post-'.$anchor;
|
||||
break;
|
||||
case 'weekly':
|
||||
if((!isset($cacheweekly)) || (empty($cacheweekly[$postdata['Date']]))) {
|
||||
$cacheweekly[$post->post_date] = $wpdb->get_var("SELECT WEEK('$post->post_date')");
|
||||
++$querycount;
|
||||
}
|
||||
echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).$querystring_separator.'w'.$querystring_equal.$cacheweekly[$post->post_date].'#post-'.$anchor;
|
||||
break;
|
||||
case 'postbypost':
|
||||
echo $file.$querystring_start.'p'.$querystring_equal.$id;
|
||||
break;
|
||||
}
|
||||
echo get_permalink();
|
||||
}
|
||||
|
||||
function permalink_single($file='') {
|
||||
|
||||
Reference in New Issue
Block a user