Menu that shows months and filters posts to show only posts from that month and shows posts as sub items

You seem to know WP so I’ll just give you the outline (This recent post from my blog includes the details anyway). The best way to do this would be to use query variables. From the comments, I gather this is what kaiser is saying.

The link (for October 2011, say) could point example.com/news/2011/10

You first add a’ generate_rewrite_rules’ filter that adds a rule, so WordPress reads this as example.com/news/?year=2011&monthnum=10,

Another filter(s), e.g. post_where, alters the query to restrict the returned posts to ‘news’ items in that year and month. Note, this method will not work if your news page uses query_posts() or WP_Query() inside its template page to get the relevant posts. If you’re using that method, you’ll need some if statements inside the template to determine if year/month is set and then alter the arguments being fed into either of those functions.

As for auto-generating the menu – you can use the php Date() function to retrieve the current month and year, and then a while loop to go through a display the last 6 months, along with the relevant link. For instance, inside a <ul> tag you could put the php code

$i=0
while ($i<6){
    $yearInt = intva(date("Y", strtotime("-".$i." months")));
    $monInt = intva(date("n",  strtotime("-".$i." months")));
    $monStr = date("F",  strtotime("-".$i." months"));
    $yearStr = date("Y",  strtotime("-".$i." months"));

    echo "<li><a href="www.example.com/news/".$yearInt."https://wordpress.stackexchange.com/".$monInt."">".$monStr." ".$yearStr"</a></li>";

    $i = $i +1;
}

Hope this helps 😀

If you are using query_posts(), then presumably you have some argument that calls up your ‘news’ posts. What you’ll want to do is add something like the following, which checks if a year and month have also been selected. You’ll want to convert the month and year into integers yearInt, monthInt (see above), and use these to adapt the argument in the query_posts() function

global $wp_query;
if (isset( $wp_query->query_vars['monthnum'] ) & isset( $wp_query->query_vars['year'] )){
    //add additional arguments to query_var(): '&year=yearInt&monthnum=monthInt'
}else{
    //Normal query_vars() (i.e. what you had before)

}