• Resolved kattouf

    (@kattouf)


    Hi,

    Currently the widget list is sorted by Event End date which is giving problems.
    How to change to Sort by Event Start date?

    Current SQL code bellow (from events-widget.php), but I can’t figure it out.

    $sql = 'select p.ID, p.post_title, m2.meta_value  from ' . $wpdb->posts . ' p ' . 
    
    			' left join ' . $wpdb->postmeta . ' m1 on m1.post_id = ID ' . 
    
    			' left join ' . $wpdb->postmeta . ' m2 on m2.post_id = ID ' . 
    
    			' where post_status = "publish" AND ( post_type = "product" OR post_type = "ignitewoo_event" ) ' . 
    
    			' AND ( m1.meta_key = "_ignitewoo_event" AND m1.meta_value = "yes" ) ' . 
    
    			' AND ( m2.meta_key = "_ignitewoo_event_end" AND m2.meta_value >= "' . date( 'Y-m-d H:i:s', current_time( 'timestamp', false ) ) . '" ) ' . 
    
    			' AND ( m2.meta_key = "_ignitewoo_event_end" AND m2.meta_value != "" ) ' . 
    
    			' ORDER BY CAST( m2.meta_value as DATE ) ASC LIMIT ' . $number ;

    https://www.ads-software.com/plugins/event-calendar-ticketing/

Viewing 1 replies (of 1 total)
  • Thread Starter kattouf

    (@kattouf)

    Figured it out! :-)`

    $sql = 'select p.ID, p.post_title, m2.meta_value, m3.meta_value  from ' . $wpdb->posts . ' p ' . 
    
    			' left join ' . $wpdb->postmeta . ' m1 on m1.post_id = ID ' . 
    
    			' left join ' . $wpdb->postmeta . ' m2 on m2.post_id = ID ' . 
    
    ' left join ' . $wpdb->postmeta . ' m3 on m3.post_id = ID ' .
    
    			' where post_status = "publish" AND ( post_type = "product" OR post_type = "ignitewoo_event" ) ' . 
    
    			' AND ( m1.meta_key = "_ignitewoo_event" AND m1.meta_value = "yes" ) ' . 
    
    			' AND ( m2.meta_key = "_ignitewoo_event_end" AND m2.meta_value >= "' . date( 'Y-m-d H:i:s', current_time( 'timestamp', false ) ) . '" ) ' . 
    
    			' AND ( m2.meta_key = "_ignitewoo_event_end" AND m2.meta_value != "" ) ' .
    
    			' AND ( m3.meta_key = "_ignitewoo_event_start" AND m3.meta_value != "" ) ' .
    
    			' ORDER BY CAST( m3.meta_value as DATE ) ASC LIMIT ' . $number ;

Viewing 1 replies (of 1 total)
  • The topic ‘Widget Orber by Sart date’ is closed to new replies.