Support » Plugins » Modifing wp_get_archives()

  • Hi people,

    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:

    1) after:

    $defaults = array(
    		'type' => 'monthly', 'limit' => '',
    		'format' => 'html', 'before' => '',
    		'after' => '', 'show_post_count' => false
    	);

    I added:

    $curauth = get_userdata(get_query_var('author'));

    2) I modified:

    $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );

    In

    $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;

    After:

    $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?

    Thanks 🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Modifing wp_get_archives()’ is closed to new replies.