WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Custom 'ORDER_BY' for Event widget or EM_Events::output (4 posts)

  1. hristo5322
    Member
    Posted 11 months ago #

    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/

  2. angelo
    NetWebLogic Support
    Posted 11 months ago #

    hi,

    maybe you can try to hook into em_events_build_sql_orderby filter;

  3. hristo5322
    Member
    Posted 11 months ago #

    Yeah .. maybe ... but I don't know how to use this, and I can't fint where to read about it :)

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 11 months ago #

    we don' have any docs on this unfortunately. you'd need to look at the code itself and figure it out.

    classes/em-events.php

    it behaves like a normal wp filter though - http://codex.wordpress.org/Plugin_API/Filter_Reference

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.