Making WordPress.org

Changeset 6213


Ignore:
Timestamp:
12/03/2017 06:18:15 PM (7 years ago)
Author:
coreymckrill
Message:

WordCamp Post Types: Add category taxonomy for sessions

This allows sessions to be better differentiated in the schedule
and elsewhere.

Props Kau-Boy
Fixes #3035

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r6013 r6213  
    677677                $session_title        = apply_filters( 'the_title', $session->post_title );
    678678                $session_tracks       = get_the_terms( $session->ID, 'wcb_track' );
     679                $session_categories   = get_the_terms( $session->ID, 'wcb_session_category' );
    679680                $session_track_titles = is_array( $session_tracks ) ? implode( ', ', wp_list_pluck( $session_tracks, 'name' ) ) : '';
    680681                $session_type         = get_post_meta( $session->ID, '_wcpt_session_type', true );
     
    702703                    foreach ( $session_tracks as $session_track ) {
    703704                        $classes[] = 'wcb-track-' . $session_track->slug;
     705                    }
     706                }
     707
     708                if ( is_array( $session_categories ) ) {
     709                    foreach ( $session_categories as $session_category ) {
     710                        $classes[] = 'wcb-session-category-' . $session_category->slug;
    704711                    }
    705712                }
     
    21242131        ) );
    21252132
     2133        // Labels for categories.
     2134        $labels = array(
     2135            'name'              => __( 'Categories', 'wordcamporg' ),
     2136            'singular_name'     => __( 'Category', 'wordcamporg' ),
     2137            'search_items'      => __( 'Search Categories', 'wordcamporg' ),
     2138            'popular_items'     => __( 'Popular Categories','wordcamporg' ),
     2139            'all_items'         => __( 'All Categories', 'wordcamporg' ),
     2140            'edit_item'         => __( 'Edit Category', 'wordcamporg' ),
     2141            'update_item'       => __( 'Update Category', 'wordcamporg' ),
     2142            'add_new_item'      => __( 'Add Category', 'wordcamporg' ),
     2143            'new_item_name'     => __( 'New Category', 'wordcamporg' ),
     2144        );
     2145
     2146        // Register the Categories taxonomy.
     2147        register_taxonomy( 'wcb_session_category', 'wcb_session', array(
     2148            'labels'       => $labels,
     2149            'rewrite'      => array( 'slug' => 'session_category' ),
     2150            'query_var'    => 'session_category',
     2151            'hierarchical' => true,
     2152            'public'       => true,
     2153            'show_ui'      => true,
     2154            'show_in_rest' => true,
     2155            'rest_base'    => 'session_category',
     2156        ) );
     2157
    21262158        // Labels for sponsor levels.
    21272159        $labels = array(
Note: See TracChangeset for help on using the changeset viewer.