Support » Fixing WordPress » sidebar Link to post monthly archives

  • can someone help me figure out how I can create a sidebar link to my monthly archives. I don’t want each of the monthly links to appear on my main pg. (my blog has existed for 3 yrs.) I’d like a single link (possibly using the “Archives” that appears above my Categories) that would take you possibly to a new pg. containing links to each month.

Viewing 15 replies - 1 through 15 (of 19 total)
  • If you still have the default WP theme files somewhere, look at the archives.php which is a page template. You could do something like that: make a page template, write a new page called Archives (or something) and choose the page template from the drop down list (on Write Page page).

    I do have the default theme files. So are you saying that what I’d do is create a new pg. template within my current theme folder? If yes, then what code from the default theme file would I add? I clearly don’t want all of it since I only want to create a pg. which has links to my monthly posts. Is there a portion of the default file that would give me that? Would you know what it is?

    And then how would I create a link in the sidebar to that new pg. with the monthly links? Specifically, could I make the word ‘Archives’ in my sidebar into a hyperlink which did that?

    Well, for example
    Template Name: Archives
    <?php get_header(); ?>
    <h2>Archives by month</h2>
    <?php wp_get_archives('type=monthly'); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I took a peek in the theme you’re using and that is the structure of the other templates (first I had told you to check what the structure is to make it the same).

    You put the code in a new php file (not named archive.php, but e.g. archives.php is good), upload the page template in the current theme folder, then write a new page, title it something you like (Archives?) and use the Page template dropdown list to choose the page template.
    You can get the path to your page when you right-click View in the list of pages and choose Copy Link Location (or something similar).

    Of course you can make the word Archives into a link, you may need to style it in the stylesheet though
    <h2><a href="path/to/page"><?php _e('Archives'); ?></a></h2>

    Thanks very much! I’ll try that.

    well, i’m having the same problem too, and I think i’d better post it here since my question is very similar to this one.

    i finally got settle in my nav bar: and I want the following pages: home, archives etc…etc….[I’m using the kubrick theme]

    just wonder where’s the archive link? if not, i have to make one, right? But how? Thanks in advance.

    OK, let me review what I’ve done to make sure I’m doing it right. I opened notepad & inserted Minna’s code into a new file. Then I saved it, calling it archives.php encoded w. utf-8. Then I uploaded this file to my current theme folder. I then created the new pg. as suggested & linked it to the new archives template. Now I have the link location:

    Now as to what to do with this…I decided that in my sidebar where it says “Archives” I’d like to add the word “(monthly)” hyperlinked to the above url.

    Would I do this via the sidebar template? Where within the sidebar template would I want to look to place the url?

    Well, if your sidebar.php code is more or less the same as the original which I looked at, there should currently be this:
    <h2><?php _e('Archives'); ?></h2>

    You can just add the (monthly) link after Archives:
    <h2><?php _e('Archives'); ?> <a href="/tikun_olam/archives-monthly/">(monthly)</a></h2>
    or replace (monthly) with <?php _e('(monthly)'); ?> if you want to “follow suit” (_e is used in translating the page with a language package)

    well, actually, i’ve just added a nav bar located in my Kubrick header picture.
    i won’t say much about the code here, since my problem is with my link.
    for example, one link to “home” of my page is as follows:
    <li class="<?php echo $highlight; ?>">">Home

    So what about my link to archives at my header? I’ve tried Richard’s method, but there were some errors, perhaps his case is slightly different from mine now. Thanks alot!

    sorry stchatterbox, I was replying to Richard

    when I visited your site some time ago, there was much more links in the vertical navigation bar, including Archives, why did you remove it? I’m not really sure what you want to link and where (and why is it so difficult). Can’t you link the archives in the same way as you’ve linked Gallery?

    😳 sorry for the interruption. do accept my apology, minna

    i’m just wondering where is my archive link that show all old archives. thanks

    @stchatterbox: you mean a page where you list months and/or categories that you can then click and see the archives? That you’d need to make yourself, in the same way I explained here.

    yup, minna, i’ve tried that, but failed again.
    I’ve created a new page and added the code<h2>< ?php _e('Archives'); ?></h2>
    as suggested, but when i go to the archives page, oh…’s just a header writing
    < ?php _e('Archives'); ?>

    how can i actually do that? i simply want to make an archive page like

    You misunderstood that code bit 🙂 Richard wanted to have the Archives word that is in the sidebar linked to a page he already had made for archives. In the same post I had explained how to make a page template for archives, which is what you need.

    As you are using the default theme, you should already have an archives.php file in your theme folder. Look in Presentation > Theme Editor and check if there’s “Archives” in the list (not Archive template). If there is Archives in the list, open the page (id 19) you just created and choose Archives from the Page template dropdown list (it’s below the content text area). Empty the text area and save.

    @stchatterbox: I use PHP Exec plugin in the Archives Page to include WP template tags(archives).

    Here is my code if you ask:
    <h2>Read by Month</h2>
    <?php wp_get_archives('type=monthly& show_post_count=1'); ?>

    <h2>Read by Category</h2>
    All entries on are categorized at the time of publishing. This is a list of the categories used at, as well as an indicator to show how many entries each category holds.
    <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?>

    Hope this helps.

    yup, I’ve got how to add an archive page already! Great!
    though the sidebar looks a bit strange in my page using minna
    ‘s code; thus i quit this time without having a sidebar on my archives page

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘sidebar Link to post monthly archives’ is closed to new replies.