Making WordPress.org


Ignore:
Timestamp:
08/13/2014 08:14:50 PM (12 years ago)
Author:
iandunn
Message:

WordCamp Post Types: Only specify speaker IDs if track(s) requested.

r779 added support for the track parameter, but introduced a bug where speakers would not show up in the list
if all tracks were requested and the speaker wasn't assigned to any session yet.

File:
1 edited

Legend:

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

    r787 r788  
    318318            'post_type' => 'wcb_speaker',
    319319            'posts_per_page' => intval( $attr['posts_per_page'] ),
    320             'post__in' => $speaker_ids,
    321320            'orderby' => $attr['orderby'],
    322321            'order' => $attr['order'],
    323322        );
    324323
     324        if ( 'all' != $attr['track'] ) {
     325            $speaker_args['post__in'] = $speaker_ids;
     326        }
     327
    325328        $speakers = new WP_Query( $speaker_args );
    326329
     
    338341                <?php
    339342                    $speaker_classes = array( 'wcorg-speaker', 'wcorg-speaker-' . sanitize_html_class( $post->post_name ) );
    340                     foreach ( $speakers_tracks[ get_the_ID() ] as $track ) {
    341                         $speaker_classes[] = sanitize_html_class( 'wcorg-track-' . $track );
     343
     344                    if ( isset( $speakers_tracks[ get_the_ID() ] ) ) {
     345                        foreach ( $speakers_tracks[ get_the_ID() ] as $track ) {
     346                            $speaker_classes[] = sanitize_html_class( 'wcorg-track-' . $track );
     347                        }
    342348                    }
    343349                ?>
Note: See TracChangeset for help on using the changeset viewer.