• I tried to search, I just cannot think of even how to phrase it.

    On an archive page, it is not pulling in the whole sidebar, where if someone was browsing the March 2004 archives, and then they wanted to go to April, they have to go all the way back to the main page, and then go to archives again, and then select from there.

    Help?
    is there a way to have the list of the archives months show on the archive page in the sidebar?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You could put something like <?php if is_archive() { wp_get_archives(‘type=monthly&limit=12’); } ?> in your sidebar

    Thread Starter Roar

    (@rori)

    This is what I used:
    <li><h2><?php _e('Archives'); ?></h2><ul><?php if is_archive() { wp_get_archives('type=monthly'); } ?></ul></li>

    and I get a parse error

    Parse error: parse error, unexpected T_STRING, expecting ‘(‘ in

    Thread Starter Roar

    (@rori)

    Okay, I cleaned the code to:

    <li><h2><?php _e('Archives'); ?></h2>
    <ul><?php if (is_archive() ) wp_get_archives('type=monthly'); ?></ul></li>
    but it still does not work.

    Help?

    The simplest way to do this is create a new sidebar and make the following changes to the archives.php file.

    First, do a Save As of the sidebar.php file. Save it as sidebar-for-archives.php. Now you have a file to include.

    Next make the following changes.
    1. Line 9 of archives.php: Change <div id="content" class="widecolumn"> to <div id="content" class="narrowcolumn">.

    2. archives.php: Right above the last line (<?php get_footer(); ?>), insert this as a new line and add <?php get_footer(); ?>.

    These changes will do two things:
    First, you will tell archives.php to use a narrow column, which will allow room for a sidebar.
    Second, you will tell archives.php to include sidebar-for-archives.php as its sidebar.

    You can then customize sidebar-for-archives.php any way that you like. I have removed the code in this file that shows archives by month and category, because archives.php is already doing this.

    You can do this on any page, really. I am even doing it on my individual post pages to include a different sidebar than the normal one on the index.php page. I wanted one that was shorter, because I include long advertizing on the index.php sidebar, and this looks bad on a page with a short post.

    Good luck! Read the WordPress codex (https://codex.www.ads-software.com). There is a section on customizing the sidebar (just type “customizing the sidebar” in the search field). That’s where I learned how to do this.

    A look at your blog shows me that you have already learned how to do this. Hope it helps someone else with the same question in the future. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Archives Page Question’ is closed to new replies.