Skip to content

Commit

Permalink
Sessions containing lightning talks cannot also *be* lightning talks
Browse files Browse the repository at this point in the history
But I still need to ID them as containing talks, rather than being talks.
  • Loading branch information
joedolson committed Sep 26, 2023
1 parent 217cd12 commit 802a97b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/inc/schedule-output-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ function wpad_draw_session( $talk, $is_current, $text, $session_id ) {
$talk_title .= '<div class="talk-speakers">' . $talk_label . implode( ', ', $speakers['list'] ) . '</div>';
$talk_title = '<div class="talk-title-wrapper">' . $talk_title . '</div>';
$talk_heading = sprintf( $time_html, ' ' . $talk_title );
if ( 'lightning' !== $talk_type ) {
if ( 'lightning-group' !== $talk_type ) {
$wrap = '<div class="wp-block-column">';
$unwrap = '</div>';
} else {
$wrap = '';
$unwrap = '';
}
$talk_output = $wrap . $sponsors;
$talk_output .= ( 'lightning' !== $talk_type ) ? '<div class="talk-description">' . wp_trim_words( $talk->post_content ) . '</div>' : '';
$talk_output .= ( 'lightning-group' !== $talk_type ) ? '<div class="talk-description">' . wp_trim_words( $talk->post_content ) . '</div>' : '';
$talk_output .= $unwrap;
$talk_output .= $wrap . $speakers['html'] . $unwrap;

Expand Down Expand Up @@ -392,7 +392,7 @@ function wpcs_session_speakers( $session_id, $talk_type = 'session' ) {
}
$title_organization = array();
ob_start();
if ( 'lightning' === $talk_type ) {
if ( 'lightning-group' === $talk_type ) {
$ltalks = get_post_meta( $session_id, 'wpad_lightning_talks', true );
if ( $ltalks ) {
$ltalks = explode( ',', $ltalks );
Expand Down Expand Up @@ -499,7 +499,7 @@ function wpcs_session_speakers( $session_id, $talk_type = 'session' ) {
}
$html .= ob_get_clean();
}
$html = ( 'lightning' !== $talk_type ) ? '<div class="wpcsp-speakers">' . $speakers_heading . $html . '</div>' : $html;
$html = ( 'lightning-group' !== $talk_type ) ? '<div class="wpcsp-speakers">' . $speakers_heading . $html . '</div>' : $html;

return array(
'list' => $list,
Expand Down
12 changes: 7 additions & 5 deletions src/wp-conference-schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public function wpcs_metabox_session_info() {
<select id="wpcs-session-type" name="wpcs-session-type">
<option value="session" <?php selected( $session_type, 'session' ); ?>><?php esc_html_e( 'Regular Session', 'wpa-conference' ); ?></option>
<option value="panel" <?php selected( $session_type, 'panel' ); ?>><?php esc_html_e( 'Panel', 'wpa-conference' ); ?></option>
<option value="lightning" <?php selected( $session_type, 'lightning' ); ?>><?php esc_html_e( 'Lightning Talks', 'wpa-conference' ); ?></option>
<option value="lightning" <?php selected( $session_type, 'lightning' ); ?>><?php esc_html_e( 'Lightning Talk', 'wpa-conference' ); ?></option>
<option value="lightning-group" <?php selected( $session_type, 'lightning-group' ); ?>><?php esc_html_e( 'Lightning Talks Group', 'wpa-conference' ); ?></option>
<option value="custom" <?php selected( $session_type, 'custom' ); ?>><?php esc_html_e( 'Custom', 'wpa-conference' ); ?></option>
</select>
</p>
Expand Down Expand Up @@ -397,7 +398,7 @@ public function wpcs_save_post_session( $post_id, $post ) {

// Update session type.
$session_type = sanitize_text_field( $_POST['wpcs-session-type'] ?? '' );
if ( ! in_array( $session_type, array( 'session', 'lightning', 'panel', 'custom' ), true ) ) {
if ( ! in_array( $session_type, array( 'session', 'lightning', 'lightning-group', 'panel', 'custom' ), true ) ) {
$session_type = 'session';
}
update_post_meta( $post_id, '_wpcs_session_type', $session_type );
Expand Down Expand Up @@ -501,14 +502,16 @@ public function wpcs_display_post_states( $states ) {
}

$session_type = get_post_meta( $post->ID, '_wpcs_session_type', true );
if ( ! in_array( $session_type, array( 'session', 'lightning', 'panel', 'custom' ), true ) ) {
if ( ! in_array( $session_type, array( 'session', 'lightning', 'lightning-group', 'panel', 'custom' ), true ) ) {
$session_type = 'session';
}

if ( 'session' === $session_type ) {
$states['wpcs-session-type'] = __( 'Session', 'wpa-conference' );
} elseif ( 'lightning' === $session_type ) {
$states['wpcs-session-type'] = __( 'Lightning Talks', 'wpa-conference' );
} elseif ( 'lightning-group' === $session_type ) {
$states['wpcs-session-type'] = __( 'Lightning Talk Group', 'wpa-conference' );
} elseif ( 'panel' === $session_type ) {
$states['wpcs-session-type'] = __( 'Panel', 'wpa-conference' );
}
Expand Down Expand Up @@ -622,8 +625,7 @@ public function shortcode_sponsors( $attr, $content ) {
<<?php echo $secondary_heading; ?>>
<?php the_title(); ?>
</<?php echo $secondary_heading; ?>>
<?php endif; ?>
<?php
<?php endif;
endif;
if ( 'list' !== $attr['type'] ) {
?>
Expand Down

0 comments on commit 802a97b

Please sign in to comment.