[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.
- The topic ‘[Plugin: Events Manager] Category Filter’ is closed to new replies.