Michael’s Rolling Archives

Actually I have no idea why I follow this thread in the first place, but what the heck.

First of all I take no credit for any of the codes. Rolling Archives core code is written by Michael, as seen on Binarybonsai.com. I already uploaded few screenshot Rolling Archives with K2 in action at my flickr album.

This is a 15 minute K2 plugin I wrote for Michael’s Rolling Archives. Don’t blame me for the dirty and newbie codes. What’s important that it work.

This is ONLY for WordPress K2 revision 163 (unmodified) and above. If you’re going to implement this on other theme then it’s your problem.

  1. Download Michael’s Rolling Archives for K2.
  2. Upload and extract the file into your plugins folder.
    wp-content/
    \_...
    \_ plugins/
            \_ k2-rollingarchives.php
            \_ rollingarchives/
    	                \_ Readme.txt
    			\_ images
    				\_ home.png
    				\_ meta-archives.png
    				\_ meta_glass_bottom.png
    				\_ meta_spikes_bg.png
    				\_ meta_spikes_up.png
    				\_ next.png
    				\_ previous.png
    				\_ rollingnavigationbg.png
    				\_ spinner.gif
    				\_ transparent.png
    			\_ rollingarchives.css
    			\_ rollingarchives.js.php
    			\_ rollingarchives.php
    
  3. I’ve optimized the stylesheet and codes for the Rolling Archives to embedded into the navigation.php. Open navigation.php, at the first line of the file add:
    
    <?php if ((function_exists('k2_rollingarchives')) && is_home() && !is_paged()) { ?>
    <?php k2_rollingarchives(); ?>
    <?php } ?>
    
    
  4. Go to your admin panel-> Plugins and activate “Michael’s Rolling Archives”.
  5. Done.

Rolling Archives no. of post customization

Open rollingarchives/rollingarchives.js and go to line 15. Change the position no according to your admin panel “Reading Options Blog Pages”. The position (number of posts to skip) variable are now equals to number of post at your admin panel “Reading Options Blog Pages”.

Displaying your post excerpt customization

You have a choice between WordPress the_excerpt or the_excerpt Reloaded plugin. The changes can be made at rollingarchives/rollingarchives.php line 15 and line 16. By default it’s using WordPress the_excerpt. Probably I’ll make a conditional statement for this to detect whether the_excerpt Reloaded exist or not. Version 0.2 and above conditionally choose either WordPress the_excerpt or the_excerpt Reloaded plugin (if exist and activated).

Additional notes

  1. There are 80% chances that other WordPress plugin can broke Rolling Archives Init script. This will probably explain why the archive content is not loaded.
  2. Since this plugin is made for K2, LiveSearch need to be activated in order to use prototype.js.php (Prototype JavaScript Framework). If not, you’ll have to add and load the file separately. Now also works with LiveSearch disabled.
  3. Make sure that your “Reading Options Blog Pages” does not exceed the number of your entire blog entries. This plugin uses the value from “Reading Options Blog Pages” to skip x number of post to be display in the rolling archives content.
  4. You can hide the PHP error by adding php_flag display_errors off to your htaccess file.
  5. Don’t forget to change the datetime permalink path in line 11, rollingarchives.php. The default setting is /archives/.

Hope it works on your K2 too :P

ADDED: Yeah it’s suck big time in IE. Browse happy.

ADDED: Don’t ask me about the 350 page count. var pagecount = Math.ceil(1750 / 5);, line 39 k2-rollingarchives.php.

UPDATE: Version 0.2. Add var pagecount fixes from Ben. Support for conditional statement to choose either WordPress excerpt or the_excerpt Reloaded. Edit previous.png image.

UPDATE: Version 0.3. The position (number of posts to skip) variable are now equals to number of post at your admin panel “Reading Options Blog Pages”. Using WordPress template tag to determine rollingarchives.php actual path.

UPDATE: Version 0.4. Fix misspelled Michael Heilemann’s name as ‘Micheal’. Sorry Mike!

UPDATE: Version 0.5. Thanks to steveo, previous page link will not go beyond the number of existing page. Now works with LiveSearch disabled.

UPDATE: Version 0.6. Fix the bug where the user doesn’t have enough posts to display by steveo.

UPDATE: Version 0.7. Path issue, again!