Custom taxonomy
-
I was trying to create a custom taxonomy. I am not getting it to register. Here are the three snippets I am adding to the functions file. What am I getting wrong?
This is my register
add_action( 'init', 'create_course_taxonomy' ); function create_course_taxonomy() { register_taxonomy( 'course', 'em_post_type_event', array( 'hierarchical' => true, 'public' => false, 'show_ui' => true, 'show_admin_column' => true, ) ); }
function my_em_own_taxonomy_register(){ register_taxonomy_for_object_type('course',EM_POST_TYPE_EVENT); register_taxonomy_for_object_type('course',EM_POST_TYPE_LOCATION); register_taxonomy_for_object_type('course','event-recurring'); }
and
add_action('init','my_em_own_taxonomy_register',100); add_filter('em_event_output_placeholder','my_em_styles_placeholders',1,3); function my_em_styles_placeholders($replace, $EM_Event, $result){ if( $result == '#_COURSE' ){ $replace = 'none'; $terms = get_the_terms( $EM_Event->post_id, 'course' ); if( count($terms) > 0 ){ foreach( $terms as $term ){ if( !empty($term->name) ){ $course[] = $term->name; } } $replace = implode(', ', $course); } } return $replace; }
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom taxonomy’ is closed to new replies.