Title: Compatibility with sqlite-integration
Last modified: October 24, 2017

---

# Compatibility with sqlite-integration

 *  [rpeyron](https://wordpress.org/support/users/rpeyron/)
 * (@rpeyron)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/compatibility-with-sqlite-integration/)
 * Hello,
 * Thanks for your great plugin. I use sqlite-integration on my wordpress instance
   and sqlite does not have MONTH and YEAR functions. Below is a small unified patch
   toward 2.0.5 version to make collapsing-archives work like a charm with sqlite.
 * Hope this helps
    Remi
 * ————–
 * diff -u collapsing-archives-2.0.5/collapsArchList.php collapsing-archives/collapsArchList.
   php
    — collapsing-archives-2.0.5/collapsArchList.php 2017-08-18 14:30:00.000000000
   +0200 +++ collapsing-archives/collapsArchList.php 2017-10-24 20:15:05.000000000
   +0200 @@ -95,8 +95,7 @@
 *  $postquery= “SELECT $wpdb->terms.slug, $wpdb->posts.ID,
    $wpdb->posts.post_name,
   $wpdb->posts.post_title, $wpdb->posts.post_author, – $wpdb->posts.post_date, 
   YEAR($wpdb->posts.post_date) AS ‘year’, – MONTH($wpdb->posts.post_date) AS ‘month’,
   + $wpdb->posts.post_date, $wpdb->posts.post_type FROM $wpdb->posts LEFT JOIN 
   $wpdb->term_relationships ON $wpdb->posts.ID = $wpdb->term_relationships.object_id
   @@ -128,6 +127,14 @@ $lastMonth=-1; $lastYear=-1; for ($i=0; $i<count($allPosts);
   $i++) { + // Restore Month & Year + if (isset($allPosts[$i]->post_date)) { + 
   $dateparts = explode(‘-‘,$allPosts[$i]->post_date); + if (count($dateparts) >
   2) { + $allPosts[$i]->year = $dateparts[0]; + $allPosts[$i]->month = $dateparts[
   1]; + }} + if ($allPosts[$i]->year != $lastYear) { $lastYear=$allPosts[$i]->year;}

The topic ‘Compatibility with sqlite-integration’ is closed to new replies.

 * ![](https://ps.w.org/collapsing-archives/assets/icon-256x256.gif?rev=2550328)
 * [Collapsing Archives](https://wordpress.org/plugins/collapsing-archives/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/collapsing-archives/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/collapsing-archives/)
 * [Active Topics](https://wordpress.org/support/plugin/collapsing-archives/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/collapsing-archives/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/collapsing-archives/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [rpeyron](https://wordpress.org/support/users/rpeyron/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/compatibility-with-sqlite-integration/)
 * Status: not a support question