Select error solved
-
On a search query without results the Ajax calendar doesnt work. I have solved it this way /plugins/ajax-calendar (ajax-calendar.php):
function modify_calendar_query( $query ) {
if ( !empty( $this->category_ids ) ) {
global $wpdb;$query = str_replace( ‘WHERE’, “LEFT JOIN {$wpdb->prefix}term_relationships ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id INNER JOIN {$wpdb->prefix}term_taxonomy ON ({$wpdb->prefix}term_relationships.term_taxonomy_id = {$wpdb->prefix}term_taxonomy.term_taxonomy_id AND {$wpdb->prefix}term_taxonomy.taxonomy=’category’) WHERE”, $query );
if ( strpos( $query, ‘ORDER’ ) !== false ){
$query = str_replace( “ORDER”, “AND {$wpdb->prefix}term_taxonomy.term_id IN (“.implode (‘,’, $this->category_ids ).’) ORDER’, $query );
}else{
$query .= “AND {$wpdb->prefix}term_taxonomy.term_id IN (“.implode (‘,’, $this->category_ids ).’)’;
$query = str_replace( “LIMIT 1″, ” “, $query );
}
}
return $query;
}
- The topic ‘Select error solved’ is closed to new replies.