• 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.