Clean Archives Reloaded

What Exactly Does This Plugin Do?

It creates a pretty list of all of the posts that you’ve made to your blog. To see an example, check out my archives page. Note that the image located there that shows the post times of recent posts is generated by a seperate plugin.

Download:

Support / Feature Request Forum:

http://wordpress.org/tags/clean-archives-reloaded

Credits / History:

This plugin is based on a concept (it no longer shares any common code) by Sebastian Schmieg for the archive page of his “Blix” theme. His code was later converted to a plugin by Shawn Grimes.

The drawback of both of those versions though was the sheer number of queries required (around 1 per month + 2 per post — it added up quick). So, I decided to make my own version which cached the output so that it was only regenerated when needed and otherwise just pulled with 1 query from the database. I was also given the idea by Chris O’Rourke to use Javascript to make the months collapsible as many people’s archives pages were getting rather long.

All of that was then replaced by the current version which uses WordPress functions and internal WordPress caching techniques to make only one query per page period.

752 thoughts on “Clean Archives Reloaded

  1. This is a great plugin but would love to be able to make separate pages for each month of each year. Only because we write about 200 articles per month, so after a year the page would have 2400 article links on one page.

    I know people have asked this already, but I figure I’d add my two cents that I think it would be great if there was a shortcode to call specific months of certain years for individual pages.

    Thanks for the hard work!

  2. I tried this plugin but seems like I am doing something wrong. The archives page shows a list of pages, categories, months, authors, and posts. It doesnt look like the one in your demo.

    Please help!

  3. Viper, I’ve been using this plugin for some time now but I’ve recently re-installed it on a client site and it isn’t working. All I’m getting is a blank page. I know I’ve inserted the code correctly on the page. Not sure what the problem might be. It looks like others have had this problem too. Could it be an incompatibility issue with certain themes?

    1. It could be running out of memory. I would suggest checking the server’s error_log or turning on display_errors.

      My plugin tries to use as few database queries as possible, but it does so at the cost of using more memory. On my (long) todo list is making this an option — few queries, high memory usage vs. lots of queries, low memory usage.

  4. OMG. Help. I love what your plugin does and it worked on WP 3.0 Multisite just fine – but for one hitch. While it displayed perfect archives on a page I named Archives, it ALSO turned the Home page, which used to display my posts, into an archive page as well.

    I’ve deleted the archives page, uninstalled and then deleted plugin and now, when I enter http://thisonewildlife.com in any browser, it adds “/archives” to it. Of course, since deleting the archive page, http://thisonewildlife.com/archives gives a 404 error.

    Why does my domain name add “/archives” to it now? More importantly, how do I make display my posts again? Right now it’s just a shell with sidebars.

  5. PS: In Settings>Reading, I tried to reset the front page to display posts but with no change. I then tried to set the front page to a specific page. It won’t do that either.

  6. Thanks for the response – and thanks again for the terrific plugin. Turns out the Redirection plugin is automatically overwriting my home page with the archive page – but only after adding the CAR code. I guess these plugins like each other enough to sneak out and play together. After confiscating their incriminating notes, I’ve grounded them both and all is right with the world once more.

    1. Did you ever figure out what happened and how to correct it? I have the same issue right now, but I want to keep using Redirection (not CAR though unfortunately).

  7. This is a great plugin. Thanks much :)

    Some queries though –
    How do I change the default CSS used in the plugin to suit my theme?
    Is there a way to show up archives by category along with archives by month?

    Appreciate your inputs.

    1. My plugin doesn’t provide any CSS of it’s own really other than modifying the cursor when hovering over a month. It’s just a standard nested unordered list. You can use the classes that the plugin applies to it’s output though to style it. Just add the rules to your theme’s style.css file.

      And no, my plugin does not support category archives.

  8. Check the accordion menu at the sidebar of my blog, find the “Table Of Content” menu. That is the work of Clean Archives Reloaded plugin. Many thanks, Viper!

    Unfortunately, when I installed it in my other blog, it doesn’t works. It shows a blank page… What is wrong with it?

  9. Trying to show content instead of the title.
    get_the_title( $post->ID ) is showing up the title.

    I tried few tweaks but could not work out. Any suggestion.

  10. Great plugin – exactly what I was looking for! I’ve tidied up the jQuery a wee bit. Doesn’t really make much of a difference, just ditched a few lines!

    If you’re interested:

    		jQuery(function($) {
    		
    			/* Fancy archive stuff */
    				$('.car-monthlisting').hide().filter(':first').fadeIn();
    				$('.car-yearmonth').click(function() {
    					$(this).next().slideToggle('fast');
    				});
    				$('.car-toggler').click(function() {
    					if ( '<?php echo js_escape( __('Expand All', 'clean-archives-reloaded') ); ?>' == jQuery(this).text() ) {
    						$(this).parent('.car-container').find('.car-monthlisting').fadeIn();
    						$(this).text('<?php echo js_escape( __('Collapse All', 'clean-archives-reloaded') ); ?>');
    					}
    					else {
    						$(this).parent('.car-container').find('.car-monthlisting').fadeOut();
    						$(this).text('<?php echo js_escape( __('Expand All', 'clean-archives-reloaded') ); ?>');
    					}
    					return false;
    				});
    			
    		});
    
  11. Nice plugin! But in WordPress 3.0.1 I got a error “Headers already sent by” clean-archives-reloaded.php in wp-include/pluggable.php on line 890
    After deactivation everything gone ok.
    Please help!

      1. I deactivate your plugin and this error is gone. I use the plugin many times on my sites, and everything work fine, but I use WP 2.7-2.9…and on WP 3.0 I receive this annoying error…

  12. I’ve just released a new version of this plugin that should greatly reduce the memory requirements of this plugin. I have no idea why I didn’t think of the solution I used earlier. Here I was this whole time thinking it was going to be a lot more complicated.

    Let me know if you run into any issues everyone.

  13. Hi, Alex, your archive plugin is awesome. Thanks a lot!
    I have a question, can I set “expand all” as default instead of must clicking it every time? Thx!

  14. Is there any way I can exclude certain categories from showing up in the archives? In the previous versions I could do it using the get_post query, but I see that you’ve removed it in the latest version. Thanks!

  15. Pingback: ?????????? | ????
  16. Pingback: Wordpress plugin |
  17. Would love it if the plugin collapsed to years as well as months! In any case, this is the only archive collapsing plugin that actually shows up after I’ve activated it.

    Thanks.

    pvener

  18. Hi, I’m checking out different archive plugin to find one that run efficiently on sites with thousands of posts. But I’m not having much luck.

    You claim that your plugin is “highly efficient”, yet it does at least one SQL query per post (I’m assuming it does that in the get_permalink() line), and this is similar to lots of other archive plugins out there.

    This isn’t ideal for me because my site has 10,000+ posts, and I don’t want to kill my database.

    Can you comment on your reasons for writing your plugin this way or if you have any plans to change this in a future release?

      1. I agree that

        get_permalink()

        should be used (as opposed to rewriting core WordPress functionality). My point, however, is that your plugin advertises that it only makes one database query when in fact it makes 1 + however many posts your site has.

        I’m not trying to just be like, “I told you so … “, I’m actually just trying to find a good solution to this issue. Until I find a better option, this is what I do:

        $query = array(
          'numberposts' => -1,
          'exclude_fields' => 'post_content'
        );
        $all_posts = get_posts($query);
        

        Then I can pass a post object to

        get_permalink()

        , so another query isn’t required. But that seems like overkill as well.

        I’ve posted this topic on stackoverflow:
        http://stackoverflow.com/questions/4778421/is-it-possible-to-have-get-posts-or-wp-query-not-return-the-post-content

  19. Getting this error

    Warning: Cannot modify header information – headers already sent by (output started at E:\CustomerData\webspaces\webspace_00100859\webapps\SiteApp293\htdocs\wp-content\plugins\custom-field-list-widget\widget_custom_field_list.php:1316) in E:\CustomerData\webspaces\webspace_00100859\webapps\SiteApp293\htdocs\wp-includes\pluggable.php on line 864

    code there is

    	if ( $is_IIS ) {
    		header("Refresh: 0;url=$location");
    	} else {
    		if ( php_sapi_name() != 'cgi-fcgi' )
    			status_header($status); // This causes problems on IIS and some FastCGI setups
    		header("Location: $location", true, $status);
    	}
    }
    endif;
    
  20. First of all, thank you for the plugin, it’s the closest I’ve come to getting an archive on my website. I like the expand/collapse look.

    Second of all, I think I mangled something while “installing”, and wonder if you wouldn’t mind taking a look?

    Here’s what I did:

    It installed as a wordpress plugin just fine, I activated it, and configured the settings. Then I went to the widget section and dragged it over to the sidebar (the only place my theme will allow me to insert widgets) Then it showed up on the sidebar, but everybit of customization – blogrolls, sponsors, follow me on twitter, etc… Disappeared.

    So I removed it.

    Then I had the (probably not so) bright idea to try installing it in my footer, by writing the code that was mentioned in the readme file for inserting the archive in a post. But the only thing that showed up was the code.

    Then I had another (probably less than stellar) idea: I would make a new page, call it Archives, install that code from the readme file, view the page’s source code, and cut and paste THAT into the footer!

    I think I got a little too much code, because my entire homepage showed up in the footer.
    So I tried cutting and pasting what I was pretty sure was the source code for just the archives.

    That’s when my archive turned into a kangaroo.

    If you look at my webpage: http://www.twiceblessedlife.com and look at the footer, you’ll see the archive monthly listings, with March expanded, and next to it a link that says “Expand All”

    If either March is collapsed, or “Expand All” is clicked, or any other month is clicked, then nothing will expand. It will briefly expand and snap shut quickly, and sorta look like my archive is hopping up and down like a kangaroo.

    I’m thinking that I either missed something in the cut and pasting process, or it’s just not totally doable. Personally, I’m thinking I’m the one with the oopsie here.

    As you can probably tell, I’m not a programmer, and yes, I do describe stuff to my auto mechanic as “The thingy was making a noise.”

    If you would be kind enough to take a look-see and let me know where I messed up, I would be extremely grateful.

  21. the plug in has some problem on my site :(
    the function Collapse All and expand all don’t work.
    I’m using wp 3.1.1, i tryed to disable all the plugins but clean archives continue to doesn’t work. does someone have some idea?
    thanks

    1. Sounds like you have a Javascript error on your site. The collapsing and expanding is done using Javascript.

      Can you triple check the URL to your site so I can take a look at it? The URL in your second comment (I deleted it and edited your first comment) doesn’t work either.

  22. Hi,

    just a quick question.
    I have password-protected posts on one of my sites that I use your plugin on that don’t show up in the archive listing.

    Is this intended behaviour or am I just being too dumb to get it right again?

    Great and simple plugin, by the way.

  23. Your archive reloaded plugin is awesome. Thanks a lot!
    But since last wordpress update: 3.2 I have a problem

    I see “expand all” as default list, instead of must clicking it every time.
    I have try: Settings ? Clean Archives ? Uncheck and check “Use Javascript to make the months collapsible” but it doen’t work again

    .

    Thx!

    .

  24. I’ve been using your plugin since long and I love it. But I just noticed an issue with it, the plugin is loading a huge jQuery code on every page of the site, thus making the site slow. Technically, it should just load only on the Archives page.

    Plz reply to my query and provide some way to fix it.

  25. Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 710026 bytes) in /home/xxx/public_html/xxx.com/wp-includes/post-template.php on line 168

    ~~~~
    I tried to ask the host to increase the memory… but they just telling me it’r coding problem.

    Can you please confirm there is no coding issue on your part here ?

    Or it’s true this is your plugin poor coding problem (as hostgator claims), then any help ?
    ~~~~

    tickets@hostgator.com to me

    My colleague is correct,

    This is a coding issue and we are not able to correct the issue. Please contact the plugin developer for further support.

    As always, our goal is exceptional service. Thank you for choosing HostGator!

    Sincerely,
    Grayson P.

  26. I’m working on a website where I want to filter out anything in the “uncategorized” category, including the clean archives. I know I can do this:

    $filtercat = $wpdb->get_results( “SELECT object_id FROM $wpdb->wp_term_relationships WHERE term_taxonomy_id = ’1′” );

    I just don’t know how to compare it or combine it with the “rawposts” query to remove those posts from the result. I’m sure I could do it directly with MySQL, but $wpdb is a different beast.

    Any help?

    1. Probably easier to just hide them. Add the highlighted lines to the plugin (the unhighlighted lines are for context):

      			$firstpost = TRUE;
      			foreach( $posts as $post ) {
      				if ( in_category( 1, $post ) )
      					continue;
      
      				if ( TRUE == $firstpost ) {
      1. I didn’t think of that. Duh.

        Thanks, Alex. I had it backwards though, so it would be !in_category( 1, $post ).

        I’m using a custom taxonomy and they’re all uncategorized under the standard categories.

        1. I purposefully did not include an exclamation point in my code because you said you wanted to exclude that category, not limit results to that category.

          You should use the exact code I gave you. ;) Or better, use this improved code I just came up with:

          		// Loop through each post and sort it into a structured array
          		foreach( $rawposts as $post ) {
          			if ( in_category( 'uncategorized', $post ) )
          				continue;
          
          			$posts[ mysql2date( 'Y.m', $post->post_date ) ][] = $post;
          		}

          'uncategorized' can be replaced with the category’s ID (i.e. 1 or whatnot) for improved performance.

  27. Pingback: ???????? - ???

Leave a Reply