Complete support for %author% in post permalinks.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-08-14 17:29:09 +00:00
parent 3258f9c219
commit 3f7ac3eb4d
1 changed files with 5 additions and 1 deletions

View File

@ -40,11 +40,12 @@ function get_permalink($id=false) {
'%postname%', '%postname%',
'%post_id%', '%post_id%',
'%category%', '%category%',
'%author%',
'%pagename%' '%pagename%'
); );
if ($id) { if ($id) {
$idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status FROM $wpdb->posts WHERE ID = $id"); $idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status, post_author FROM $wpdb->posts WHERE ID = $id");
} else { } else {
$idpost = $post; $idpost = $post;
} }
@ -60,6 +61,8 @@ function get_permalink($id=false) {
$cats = get_the_category($idpost->ID); $cats = get_the_category($idpost->ID);
$category = $cats[0]->category_nicename; $category = $cats[0]->category_nicename;
$authordata = get_userdata($idpost->post_author);
$author = $authordata->user_nicename;
$rewritereplace = array( $rewritereplace = array(
date('Y', $unixtime), date('Y', $unixtime),
@ -71,6 +74,7 @@ function get_permalink($id=false) {
$idpost->post_name, $idpost->post_name,
$idpost->ID, $idpost->ID,
$category, $category,
$author,
$idpost->post_name, $idpost->post_name,
); );
return get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink); return get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink);