Support » Plugins and Hacks » Modifing wp_get_archives()
9 years, 2 months ago
I’m tring to modify the main wp_get_archives() in order to request an author id and show their posts like in the main function.
I know the the_author_posts_link() is similar but I’d like to view archives like on the wp_get_archives() function.
So… I made some modifies to general-template.php:
$defaults = array(
'type' => 'monthly', 'limit' => '',
'format' => 'html', 'before' => '',
'after' => '', 'show_post_count' => false
$curauth = get_userdata(get_query_var('author'));
2) I modified:
$where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
$where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish' AND post_author = " . $curauth->ID, $r );
3) I also added:
$url = $url . "&author=" . $curauth->ID;
$url = get_month_link($arcresult->year, $arcresult->month);
Ok everything seems to work, but the result page doesn’t appear like an archive page, but just like a filtered main page.
How can I solve this?
Anyway, doesn’t work with permalinks on 🙁
The link it gives me http://server.com/2008/02/&author=1
http://server.com/2008/02/?author=1 redirect to the global author page and isn’t permalink compliant.