Making WordPress.org

Ticket #2159: 2159.diff

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

     
    404404                        'avatar_size'    => 100,
    405405                        'posts_per_page' => -1,
    406406                        'orderby'        => 'date',
     407                        'team'           => '',
    407408                ), $attr );
    408409
    409410                $attr['show_avatars'] = $this->str_to_bool( $attr['show_avatars'] );
     
    410411                $attr['orderby'] = strtolower( $attr['orderby'] );
    411412                $attr['orderby'] = ( in_array( $attr['orderby'], array( 'date', 'title', 'rand' ) ) ) ? $attr['orderby'] : 'date';
    412413
    413                 $organizers = new WP_Query( array(
     414                $query_args = array(
    414415                        'post_type' => 'wcb_organizer',
    415416                        'posts_per_page' => intval( $attr['posts_per_page'] ),
    416417                        'orderby' => $attr['orderby'],
    417                 ) );
     418                );
    418419
     420                if ( ! empty( $attr['team'] ) ) {
     421                        $query_args['tax_query'] = array(
     422                                array(
     423                                        'taxonomy' => 'wcb_team',
     424                                        'field'    => 'slug',
     425                                        'terms'    => $attr['team'],
     426                                ),
     427                        );
     428                }
     429
     430                $organizers = new WP_Query( $query_args );
     431
    419432                if ( ! $organizers->have_posts() )
    420433                        return '';
    421434
     
    20032016                        'public'                => true,
    20042017                        'show_ui'               => true,
    20052018                ) );
     2019
     2020                // Labels for organizer teams.
     2021                $labels = array(
     2022                        'name'              => __( 'Teams', 'wordcamporg' ),
     2023                        'singular_name'     => __( 'Team', 'wordcamporg' ),
     2024                        'search_items'      => __( 'Search Teams', 'wordcamporg' ),
     2025                        'popular_items'     => __( 'Popular Teams', 'wordcamporg' ),
     2026                        'all_items'         => __( 'All Teams', 'wordcamporg' ),
     2027                        'edit_item'         => __( 'Edit Team', 'wordcamporg' ),
     2028                        'update_item'       => __( 'Update Team', 'wordcamporg' ),
     2029                        'add_new_item'      => __( 'Add Team', 'wordcamporg' ),
     2030                        'new_item_name'     => __( 'New Team', 'wordcamporg' ),
     2031                );
     2032
     2033                // Register organizer teams taxonomy
     2034                register_taxonomy( 'wcb_team', 'wcb_organizer', array(
     2035                        'labels'                => $labels,
     2036                        'rewrite'               => array( 'slug' => 'team' ),
     2037                        'query_var'             => 'team',
     2038                        'hierarchical'          => true,
     2039                        'public'                => true,
     2040                        'show_ui'               => true,
     2041                ) );
    20062042        }
    20072043
    20082044        /**