Making WordPress.org

Ticket #2850: 2850.3.diff

File 2850.3.diff, 2.6 KB (added by Kau-Boy, 8 years ago)
  • wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
    index efbd160..3dc7a0b 100644
    class WordCamp_Post_Types_Plugin { 
    281281                        'order'          => 'desc',
    282282                        'track'          => '',
    283283                        'speaker_link'   => '',
     284                        'groups'         => '',
    284285                ), $attr );
    285286
    286287                foreach ( array( 'orderby', 'order', 'track', 'speaker_link' ) as $key_for_case_sensitive_value ) {
    class WordCamp_Post_Types_Plugin { 
    292293                $attr['order']        = in_array( $attr['order'],        array( 'asc', 'desc'           ) ) ? $attr['order']        : 'desc';
    293294                $attr['speaker_link'] = in_array( $attr['speaker_link'], array( 'permalink'             ) ) ? $attr['speaker_link'] : '';
    294295                $attr['track']        = array_map( 'trim', explode( ',', $attr['track'] ) );
     296                $attr['groups']       = array_map( 'trim', explode( ',', $attr['groups'] ) );
    295297
    296298                // Fetch all the relevant sessions
    297299                $session_args = array(
    class WordCamp_Post_Types_Plugin { 
    347349                        $speaker_args['post__in'] = $speaker_ids;
    348350                }
    349351
     352                if ( ! empty( $attr['groups'] ) ) {
     353                        $speaker_args['tax_query'] = array(
     354                                array(
     355                                        'taxonomy' => 'wcb_speaker_group',
     356                                        'field'    => 'slug',
     357                                        'terms'    => $attr['groups'],
     358                                ),
     359                        );
     360                }
     361
    350362                $speakers = new WP_Query( $speaker_args );
    351363
    352364                if ( ! $speakers->have_posts() )
    class WordCamp_Post_Types_Plugin { 
    20562106                                'show_ui'      => true,
    20572107                        )
    20582108                );
     2109
     2110                // Labels for speaker groups.
     2111                $labels = array(
     2112                        'name'          => __( 'Groups',         'wordcamporg' ),
     2113                        'singular_name' => __( 'Group',          'wordcamporg' ),
     2114                        'search_items'  => __( 'Search Groups',  'wordcamporg' ),
     2115                        'popular_items' => __( 'Popular Groups', 'wordcamporg' ),
     2116                        'all_items'     => __( 'All Groups',     'wordcamporg' ),
     2117                        'edit_item'     => __( 'Edit Group',     'wordcamporg' ),
     2118                        'update_item'   => __( 'Update Group',   'wordcamporg' ),
     2119                        'add_new_item'  => __( 'Add Group',      'wordcamporg' ),
     2120                        'new_item_name' => __( 'New Group',      'wordcamporg' ),
     2121                );
     2122
     2123                // Register speaker groups taxonomy
     2124                register_taxonomy(
     2125                        'wcb_speaker_group',
     2126                        'wcb_speaker',
     2127                        array(
     2128                                'labels'       => $labels,
     2129                                'rewrite'      => array( 'slug' => 'speaker-group' ),
     2130                                'query_var'    => 'group',
     2131                                'hierarchical' => true,
     2132                                'public'       => true,
     2133                                'show_ui'      => true,
     2134                        )
     2135                );
    20592136        }
    20602137
    20612138        /**