| 350 | | // Categories |
| 351 | | if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) { |
| 352 | | foreach ( (array) get_the_category($post->ID) as $cat ) { |
| 353 | | if ( empty($cat->slug ) ) |
| 354 | | continue; |
| 355 | | $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->term_id); |
| | 350 | // All public taxonomies |
| | 351 | $taxonomies = get_taxonomies( array( 'public' => true ), 'names', 'and' ); |
| | 352 | if ( is_array( $taxonomies ) ) { |
| | 353 | foreach ( $taxonomies as $taxonomy ) { |
| | 354 | if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) { |
| | 355 | foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) { |
| | 356 | if ( empty( $term->slug ) ) |
| | 357 | continue; |
| | 358 | if ( 'post_tag' == $taxonomy ) |
| | 359 | $classes[] = 'tag-' . sanitize_html_class( $term->slug, $term->term_id ); |
| | 360 | else |
| | 361 | $classes[] = sanitize_html_class( $taxonomy->name . '-' . $term->slug, $taxonomy->name . '-' . $term->term_id ); |
| | 362 | } |
| | 363 | } |