Making WordPress.org

Changeset 5545


Ignore:
Timestamp:
06/06/2017 07:40:01 PM (8 years ago)
Author:
coreymckrill
Message:

WordCamp Post Types: Enable and clean up track param for [speakers]

The track parameter for the speakers shortcode was experimentally
added for a single camp in 2014, but was never fully enabled. This
commit removes the restriction to the single camp, and adds some extra
sanitization to the parameter value before adding it to the sessions
query.

File:
1 edited

Legend:

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

    r5533 r5545  
    280280            'orderby'        => 'date',
    281281            'order'          => 'desc',
    282             'track'          => 'all',
     282            'track'          => '',
    283283            'speaker_link'   => '',
    284284        ), $attr );
     
    292292        $attr['order']        = in_array( $attr['order'],        array( 'asc', 'desc'           ) ) ? $attr['order']        : 'desc';
    293293        $attr['speaker_link'] = in_array( $attr['speaker_link'], array( 'permalink'             ) ) ? $attr['speaker_link'] : '';
    294 
    295         /*
    296          * Only allow 2014.capetown to use the new track attribute
    297          * @todo Remove this and update docs after stakeholder review
    298          */
    299         if ( ! in_array( get_current_blog_id(), apply_filters( 'wcpt_filter_speakers_by_track_allowed_sites', array( 423 ) ) ) ) {
    300             $attr['track'] = 'all';
    301         }
     294        $attr['track']        = array_map( 'trim', explode( ',', $attr['track'] ) );
    302295
    303296        // Fetch all the relevant sessions
     
    307300        );
    308301
    309         if ( 'all' != $attr['track'] ) {
     302        if ( ! empty( $attr['track'] ) ) {
    310303            $session_args['tax_query'] = array(
    311304                array(
    312305                    'taxonomy' => 'wcb_track',
    313306                    'field'    => 'slug',
    314                     'terms'    => explode( ',', $attr['track'] ),
     307                    'terms'    => $attr['track'],
    315308                ),
    316309            );
     
    351344        );
    352345
    353         if ( 'all' != $attr['track'] ) {
     346        if ( ! empty( $attr['track'] ) ) {
    354347            $speaker_args['post__in'] = $speaker_ids;
    355348        }
Note: See TracChangeset for help on using the changeset viewer.