• Hi,

    How can I show links to my Archives in my sidebar..I want it to look like this:

    2010
    Month (Post Count)
    Month (Post Count)
    Month (Post Count)
    2009
    Month (Post Count)
    Month (Post Count)
    Month (Post Count)

    etc..obviously the months are a sublist of each year.

    Is this possible? The basic “Archives” widget does not have this functionality it seems. If somebody can just point me in the right direction it would be of great help as I can’t find any functions other than wp_get_archives which doesn’t seem to be able to achieve this either.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    try this in your sidebar:

    <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
                    <option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
    				<?php wp_get_archives('type=monthly&limit=12&format=option&show_post_count=0'); ?></select>
    Thread Starter xdesi

    (@xdesi)

    Hi,

    Thanks a lot for the reply, that does display the archives in a dropdown of months, but it’s just a layout issues really I was hoping I could get it to be like:

    <ul>
      <li><a href="#">2010 (23)</a></li>
        <ul>
          <li><a href="#">September (20)</li>
          <li><a href="#">August (3)</li>
        </ul>
      <li><a href="#">2009 (25)</a></li>
        <ul>
          <li><a href="#">December (20)</li>
          <li><a href="#">Novemeber (5)</li>
        </ul>

    etc.. you get the jist, obviously the links would link to the correct place. Is wp_get_archives the only function related to getting archives?

    Moderator t-p

    (@t-p)

    This what I did in my sidebar:

    <li>
    			<h2>12-Monthly Archives</h2>
    				<ul><li>
    				<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
                    <option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
    				<?php wp_get_archives('type=monthly&limit=12&format=option&show_post_count=0'); ?></select>
    			</li></ul>

    hope this helps further.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Show Archives in Sidebar?’ is closed to new replies.