I've tried to hard-code it and to inject var into the eventon array, but it didn't worked, so I used shortcode.
What I did is compare the page title to the event_type category (textonomy) name. If it is true, you will get only the relevant events. if not - the plugin will not be loaded.
This is how it's done:
<?php
/************************************ EVENTS ***********************************/
/* Display custom events for each page by Oshri Ben Hamo - www.artipixel.co.il */
// retrieve category ID
function get_category_id($category_name) {
$term = get_term_by('name', $category_name, 'event_type');
return $term->term_id;
}
// retrieve category Name
function get_category_name($category_name) {
$term = get_term_by('name', $category_name, 'event_type');
return $term->name;
}
//calls
$ttl = get_the_title();
$category_id = get_category_id($ttl);
$cat_name = get_category_name($ttl);
if($cat_name==$ttl){
echo do_shortcode("[add_eventon event_type='$category_id']");
}
/********************************** END EVENTS ********************************/
?>
Hope this helps anybody,
I was looking for a solution to make it hardcoded and not using shortcode.
I would love to hear about one for the future. thax!