Support » Plugin: Events Manager » Custom 'ORDER_BY' for Event widget or EM_Events::output

  • Resolved hristo5322

    (@hristo5322)


    Hi! I need a custom order_by for events widget. I created a new field in wp_em_events called ‘times_viewed’ and added sql query to increase its value by 1 (as a counter) in single-event.php. I did modified event widget like this to add the order by new option

    $this->em_orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array(
    			'event_start_date,event_start_time,event_name' => __('start date, start time, event name','dbem'),
    			'event_name,event_start_date,event_start_time' => __('name, start date, start time','dbem'),
    			'event_name,event_end_date,event_end_time' => __('name, end date, end time','dbem'),
    			'event_end_date,event_end_time,event_name' => __('end date, end time, event name','dbem'),
                'view_times' => __('times reviewed','dbem'), /*by ico*/
                'accentuation,event_id' => __('accentuation, event id','dbem'), /*by ico*/
                'recomended,event_id' => __('recomended, event id','dbem'), /*by ico*/
                'see_also,event_id' => __('see also, event id','dbem'), /*by ico*/
    			'event_id' => __('event id','dbem'), /*by ico*/
    		));

    well it is not working (not correct ordering). I’ve created other order by options and they are working just fine but this one doesn’t.

    I also tryed:

    $category = '51,72,73,74,76,77,71,75';
                        echo EM_Events::output( array('limit'=>3, 'scope'=>'all', 'pagination' => 0, 'format_header' => $format_header, 'format'=>$template, 'format_header' => $format_header, 'category'=>$category, 'order_by' => 'view_times', 'order' => 'DESC') );

    Again no ordering in correct way …
    Can anyone help me … ?

    http://wordpress.org/extend/plugins/events-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom 'ORDER_BY' for Event widget or EM_Events::output’ is closed to new replies.