Support » Plugin: Events Manager - Calendar, Bookings, Tickets, and more! » [Plugin: Events Manager] Category Filter

  • Hi Guys,

    I really love this plugin because it helps a lot when it comes to events and I just wanted to contribute a little modification of mine and hoping this would help.

    This is made to filter the event by category and all you have to do is to add a GET variable like this:

    ecateogry=categoryID

    Here’s the modification…

    1. Go to the plugin directory and find classes/em-events.php and find this code:

    function get( $args = array() ) {
    global $wpdb;
    $events_table = $wpdb->prefix . EM_EVENTS_TABLE;
    $locations_table = $wpdb->prefix . EM_LOCATIONS_TABLE;

    2. Add this little code below:

    if(isset($_GET['ecategory'])){
    $e_category = $_GET['ecategory'];
    $ecat_query = " AND event_category_id = ".$e_category." ";
    }else{
    $ecat_query = "";
    }

    3. Then find this code:

    //Create the SQL statement and execute
    
    $sql = "
    
    SELECT * FROM $events_table
    
    LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id
    
    $where
    
    $orderby_sql
    
    $limit $offset
    
    ";

    4. Add this “$ecat_query” below the “$where”.

    5. Test if it works… It works on my end.hehe.

    I hope that helps a lot for filtering and hoping it will be inserted on the next version. 😉

    I’m developing a category list widget for this plugin and let you guys know if it’s finished.

    GoodLuck

    Ryan G.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Thanks for the contribution. Didn’t get the notification mail for this, must have slipped past in all the xmas emails!

    Thread Starter Ryan Gonzales

    (@ryngonz)

    Hi Guys,

    Here’s the I widget that I made.
    EM Category List

    The widget is functional if you applied or coded the modification I posted.

    Hope this scores big time for the users. I would be glad to see my work be included on the next version.

    Enjoy,

    Ryan G.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Hi ryngonz,

    I’ve had a look at this now, but I can’t use this for various reasons. It’s mostly to do with the first fix rather than the widget, because this functionality should be implemented in /em-events.php.

    We’ll be adding some more category functionality v.soon though, so once that’s in it’ll be no problem to add a widget like this.

    For now, look at the dev version, I added something just now so category_id in the querystring will do what you were trying to do with the first fix. if you change the category list widget it should work.

    Sorry to resurrect this but I have a similar query.

    I have 5 categories and I would like to set up 5 pages each to show only events from a specific category. It seems to me a template of some sorts would do the job, but I can’t find any instuctions for this.

    Can you help?

    Anyone? Getting a bit desperate. I really don’t understand the settings page where ‘single catetgory page’ might do the job. But where do I implement this? How do I tell it display one category?

    Apologies, separate thread started as this thread was missing the events-manager tag and I thought it wasn’t showing on the events-manager board.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Events Manager] Category Filter’ is closed to new replies.