• Hi all.
    It seems to be a known problem: as the admin one can change the “archive mode” to something other than “monthly”, but the archive in the blog will stay unchanged. Someone already hinted in the forum that this is because the archive mode has been hardcoded in index.php. For those not too familiar with php, I’d like to give short instructions on how to change that.
    0. Assumptions and “Preface”
    I’ll assume from now on that you installed wordpress in the directory “wordpress/” under your wwwroot-directory. If your wwwroot is “/var/www”, the complete path to wordpress will be “/var/www/wordpress” accordingly. This will be referred to as “your wordpress directory”.
    You are free to edit the mentioned file(s) directly on your webserver (given that you have shell access to it) or on your home pc. In the latter case you have to upload the changed files to the webserver, of course.
    Be sure to make a copy of every file that will be modified. In this case that’s only index.php from your wordpress directory.
    1. Open the file index.php that can be found in your wordpress directory, using your favorite editor.
    2. Look out for the following lines:

    • Archives:
      <?php get_archives('monthly'); ?>

    If index.php hasn’t been modified yet that’ll be lines 80-84.
    3. Replace the line <?php get_archives('monthly'); ?> to <?php get_archives($archive_mode); ?>.
    4. You’re done. Save your changes and see, if it works like you want (well, it should ;)).
    Hope that helps.
    Bye, Mike

Viewing 10 replies - 1 through 10 (of 10 total)
  • Or you can change it to “postbypost”, “weekly”, etc. It will remain monthly in the default template.

    hmmm
    get_archives() worked for me. Is that poor form?
    http://www.wealthesteem.org

    Thread Starter otaku42

    (@otaku42)

    Umm, sorry. I thought that enclosing code into -tags should prevent them from becoming changed. It seems that I was wrong… at least Mozilla seems to interpret them 🙁
    Ok, I’ll try it this way then:
    Those lines that should be displayed in the second step above should look like this:
    [li]Archives:
    [ul]
    [?php get_archives(‘monthly’); ?]
    [/ul]
    [/li]
    Think of having < (‘<‘) and > (‘>’) instead of [ and ] (let’s see what the forum makes out of this line 😉

    Hey allusion,
    Isn’t it a bug that the default index.php doesn’t follow the setting in the admin panel?
    I’m not trying to be rude, it just seems a bit counter-intuitive. And it seems to catch every newbie.

    Thread Starter otaku42

    (@otaku42)

    @allusion: I did test that mod right before posting it, using it with a fresh wordpress installation. It worked for me, i.e. now I’ll see the archive in the way I set it up to be in the administration panel (options / archive mode), instead of always having the monthly archive no matter what mode I set up.

    Hi All,
    otaku42, I know what you mean about the default call in index.php not reflecting the setting in admin.
    When the archives was originally taken out of the separate file and made into a function, it didn’t do anything if you didn’t provide the parameter. I fixed that a while ago so that if you call it with no parameters it picks up the default setting in admin.
    So Paulzag’s observation is the more correct version.
    I think I will change the template to reflect this.
    Mike

    Hey Mike
    I noticed in the CVS that you put the hardcode monthly back in. How come? or is there somewhere I can monitor the discussion on that?
    I am quite happy with whatever the dev-team decides about that, but it’s good to know so newbies are told.

    Hi Paul,
    It was as a result of an email discussion with Matt who wants to make the default archive mode postbypost.
    Having the sample index file pickup the default would put everyone’s posts in their sidebar.
    Mike

    We really need to clean up these ‘options’ that don’t do what they are expected to do…

    I’m looking to have a postbypost listing but only for the current month – so that the list doesn’t go on endlessly. Is there a way to code that? For example, now that it has changed to December, all the November listings would stop showing and I’d just have one there for December 1.
    Can you let me know if this is possible, and if so, how I’d change the code?
    Thanks very much.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Removing the hardcoded monthly-archive’ is closed to new replies.