false, ); $r = wp_parse_args( $args, $defaults ); $output = '
' . '' . '' . ''; list( $data, $usecolumns ) = sportspress_get_calendar_data( $id, true ); if ( isset( $r['columns'] ) ) $usecolumns = $r['columns']; $output .= ''; if ( $usecolumns == null || in_array( 'event', $usecolumns ) ) $output .= ''; if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ) $output .= ''; if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) $output .= ''; if ( $usecolumns == null || in_array( 'article', $usecolumns ) ) $output .= ''; $output .= '' . '' . ''; $i = 0; foreach ( $data as $event ): $teams = get_post_meta( $event->ID, 'sp_team' ); $results = get_post_meta( $event->ID, 'sp_results', true ); $video = get_post_meta( $event->ID, 'sp_video', true ); $output .= ''; $output .= ''; if ( $usecolumns == null || in_array( 'event', $usecolumns ) ) $output .= ''; if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ): $output .= ''; endif; if ( $usecolumns == null || in_array( 'time', $usecolumns ) ) $output .= ''; if ( $usecolumns == null || in_array( 'article', $usecolumns ) ): $output .= ''; endif; $output .= ''; $i++; endforeach; $output .= '' . '
' . __( 'Date', 'sportspress' ). '' . __( 'Event', 'sportspress' ). '' . __( 'Teams', 'sportspress' ). '' . __( 'Time', 'sportspress' ). '' . __( 'Article', 'sportspress' ). '
' . get_post_time( get_option( 'date_format' ), false, $event ) . '' . $event->post_title . ''; $teams = get_post_meta( $event->ID, 'sp_team', false ); if ( $teams ): foreach ( $teams as $team ): $name = get_the_title( $team ); if ( $name ): $team_results = sportspress_array_value( $results, $team, null ); if ( $main_result ): $team_result = sportspress_array_value( $team_results, $main_result, null ); else: if ( is_array( $team_results ) ): end( $team_results ); $team_result = prev( $team_results ); else: $team_result = null; endif; endif; $output .= $name; if ( $team_result != null ): $output .= ' (' . $team_result . ')'; endif; $output .= '
'; endif; endforeach; else: $output .= '—'; endif; $output .= '
' . get_post_time( get_option( 'time_format' ), false, $event ) . ' '; if ( $video ): $output .= '
'; elseif ( has_post_thumbnail( $event->ID ) ): $output .= '
'; endif; if ( $event->post_content !== null ): if ( $event->post_status == 'publish' ): $output .= __( 'Recap', 'sportspress' ); else: $output .= __( 'Preview', 'sportspress' ); endif; endif; $output .= '
'; if ( $id && $r['show_all_events_link'] ) $output .= '' . __( 'View all events', 'sportspress' ) . ''; $output .= '
'; return apply_filters( 'sportspress_event_list', $output ); } } function sportspress_event_list_shortcode( $atts ) { if ( isset( $atts['id'] ) ): $id = $atts['id']; unset( $atts['id'] ); elseif( isset( $atts[0] ) ): $id = $atts[0]; unset( $atts[0] ); else: $id = null; endif; return sportspress_event_list( $id, $atts ); } add_shortcode('event-list', 'sportspress_event_list_shortcode'); add_shortcode('events-list', 'sportspress_event_list_shortcode');