Removing the hardcoded monthly-archive
-
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
- The topic ‘Removing the hardcoded monthly-archive’ is closed to new replies.