Here's code I've modified to display an archive list of every month I've posted news. Each month of course links to the archive for that month. I can then include the shortcode wherever I like.
function my_archives($params, $content = null) {
extract(shortcode_atts(array(
'type' => 'style1'
), $params));
ob_start();
?>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
<?php return ob_get_clean();
}
add_shortcode('archives','my_archives');
However, I just cannot figure out from reading the wp_get_archives page (http://codex.wordpress.org/Function_Reference/wp_get_archives) how to organize the list of months with, say, a year heading. So right now the above code outputs like this:
<li>June 2014</li>
<li>May 2014</li>
<li>April 2014</li>
etc. etc. etc. for every year and month (my website has been up for 11 years, so that's over 100 links in one blob of a list).
I was wondering if it is even possible to change the list to something like this instead:
<b><u>2014</u></b><ul>
<li>June 2014</li>
<li>May 2014</li>
etc.</ul>
<b><u>2013</u></b><ul>
<li>December 2014</li>
<li>November 2014</li>
etc.</ul>
Thank you!