Plugin Directory

Changeset 629443


Ignore:
Timestamp:
11/24/2012 04:37:11 PM (13 years ago)
Author:
ashrafweb
Message:

sql new update

Location:
related-posts-list-grid-and-slider-all-in-one
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • related-posts-list-grid-and-slider-all-in-one/tags/1.7/related.php

    r628980 r629443  
    266266    } else {
    267267        $searches = false;
    268     }
    269 return $searches+$searches;
     268    }
     269$idslist = "'" . $post->ID. "'";
     270if ($mycount > 0) {
     271    for ($i = 0; $i < $mycount; $i++) {
     272           $idslist = $idslist . ", '" . $searches[$i]->ID. "'";
     273    }
     274}
     275$new_limit = $limit - $mycount;
     276$sql = "SELECT ID,post_title,post_date "
     277        . "FROM ". "$wpdb->posts "
     278        ." WHERE "
     279        ."post_type = 'post' and post_status = 'publish' "
     280        . "AND (id NOT IN ($idslist)) "
     281        ."LIMIT ".$new_limit;
     282        $searches2 = $wpdb->get_results($sql);
     283$merged_searches = array_merge($searches, $searches2);
     284return $merged_searches;
    270285}
    271286//------------------------------------------------------------------------
  • related-posts-list-grid-and-slider-all-in-one/trunk/related.php

    r628980 r629443  
    266266    } else {
    267267        $searches = false;
    268     }
    269 return $searches+$searches;
     268    }
     269$idslist = "'" . $post->ID. "'";
     270if ($mycount > 0) {
     271    for ($i = 0; $i < $mycount; $i++) {
     272           $idslist = $idslist . ", '" . $searches[$i]->ID. "'";
     273    }
     274}
     275$new_limit = $limit - $mycount;
     276$sql = "SELECT ID,post_title,post_date "
     277        . "FROM ". "$wpdb->posts "
     278        ." WHERE "
     279        ."post_type = 'post' and post_status = 'publish' "
     280        . "AND (id NOT IN ($idslist)) "
     281        ."LIMIT ".$new_limit;
     282        $searches2 = $wpdb->get_results($sql);
     283$merged_searches = array_merge($searches, $searches2);
     284return $merged_searches;
    270285}
    271286//------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.