@mibrad_za,
Which Event Calendar plugin are you using? Have you also registered the custom post type?
Its the All in One Event Calender by Time.ly ver 1.11.4
The code for registering custom post types are in the same standalone plugin.
function my_post_types($types) {
$types[] = ‘ai1ec_event’;
return $types;
}
add_filter(‘s2_post_types’,’my_post_types’);
which all works fine.
@mibrad_za,
This has been raised before, some code that worked is contained in this post (I think you need to add another taxonomy type perhaps):
http://wordpress.org/support/topic/plugin-subscribe2-notifications-for-customer-events?replies=31#post-3256055
But note that the event MUST be save as draft rather than published immediately after typing or you get an error.
I’m only wanting one type of custom taxonomy so that is fine.
Please also understand that the plugin is working fine with the custom taxonomy code used except for in the email template where I use the {CATS} element to bring in the custom taxonomy. Should I create another element for this and where would I start to look?
@mibrad_za,
Okay, let’s try some investigating. Find an ID number for a post made into the custom posy type and then called this function with that id:
£post_IID = 1; // the post ID number
$cats = wp_get_object_terms($post_ID, 'events_categories', array('fields' => 'names'));
var_dump($cats);
Does that output an array of custom category names?
Would it not be here somewhere?
function all_cats($exclude = false, $orderby = 'slug') {
$all_cats = array();
$s2_taxonomies = apply_filters('s2_taxonomies', array('category'));
foreach( $s2_taxonomies as $taxonomy ) {
if ( taxonomy_exists($taxonomy) ) {
$all_cats = array_merge($all_cats, get_categories(array('hide_empty' => false, 'orderby' => $orderby, 'taxonomy' => $taxonomy)));
}
}
if ( $exclude === true ) {
// remove excluded categories from the returned object
$excluded = explode(',', $this->subscribe2_options['exclude']);
// need to use $id like this as this is a mixed array / object
$id = 0;
foreach ( $all_cats as $cat) {
if ( in_array($cat->term_id, $excluded) ) {
unset($all_cats[$id]);
}
$id++;
}
}
return $all_cats;
I tried replacing the array(‘category’) with array(‘events_categories’) but still ended up with nothing..
@mibrad_za,
No, it’s nothing to do with that because that line:
$s2_taxonomies = apply_filters(‘s2_taxonomies’, array(‘category’));
Creates a variable contained the default taxonomy (which is ‘categories’) and adds to it anything added by a custom taxonomy filter (like the code you wrote that adds ‘ai1ec_event’.
If you can run this code:
$post_ID = 1; // the post ID number
$cats = wp_get_object_terms($post_ID, 'events_categories', array('fields' => 'names'));
var_dump($cats);
We can find out if WordPress thinks the post contains any categories in the first place and maybe identify the issue.