Permalink hack
-
I’ve to do a new get_archives() function like in order to filter the author’s posts.
Everything went ok selecting the posts, but not getting the right link using permalinks.
The problem, in my opinion is here:
function sgr_get_month_link($year, $month, $author_id, $author_nicename) {
global $wp_rewrite;
if ( !$year )
$year = gmdate(‘Y’, time()+(get_option(‘gmt_offset’) * 3600));
if ( !$month )
$month = gmdate(‘m’, time()+(get_option(‘gmt_offset’) * 3600));
$monthlink = $wp_rewrite->get_month_permastruct();
if ( !empty($monthlink) ) {
$monthlink = str_replace(‘%author%’, $author_nicename, $monthlink);
$monthlink = str_replace(‘%year%’, $year, $monthlink);
$monthlink = str_replace(‘%monthnum%’, zeroise(intval($month), 2), $monthlink);
return apply_filters(‘month_link’, get_option(‘home’) . user_trailingslashit($monthlink, ‘month’), $year, $month);
} else {
return apply_filters(‘month_link’, get_option(‘home’) . ‘/?author=’ . $author_id . ‘&m=’ . $year . zeroise($month, 2), $year, $month);
}
}As you can see I added the author_id variable to the non-permalink option, but I really cannot understand how to modify the permalink option in order to have the author too, because the get_month_permastruct is related just to month.
Can somebody help me?
The topic ‘Permalink hack’ is closed to new replies.