'artist') , $atts, 'artistpress-show-list') ); sanitize_text_field( $order ); if( $order == 'venue' ) { $showListDisplay = 'show_venue'; } elseif( $order == 'date') { $showListDisplay = 'show_date'; } elseif( $order == 'artist') { $showListDisplay = 'show_artist'; } $current_meta_value = NULL; $shortcodeContent = '
'; $args = array( 'post_type' => 'show', 'meta_key' => 'artistpress_' . $showListDisplay, 'orderby' => 'meta_value', 'order' => 'ASC', ); //the query $shows = new WP_Query( $args ); if ( $shows->have_posts() ) { while ( $shows->have_posts() ) { $shows->the_post(); // Cache the variables that are set by query $showID = get_the_ID(); $show_meta_data = get_post_custom($showID); $showDate = esc_html( get_post_meta($showID, 'artistpress_show_date', true) ); $showTicketWeb = esc_html( get_post_meta($showID, 'artistpress_ticket_url', true) ); if ( $showTicketWeb != NULL ){ $showTicketWeb = trim($showTicketWeb, '/'); if (!preg_match('#^http(s)?://#', $showTicketWeb)) { $showTicketWeb = 'http://' . $showTicketWeb; } } $artistID = unserialize($show_meta_data['artistpress_show_artist'][0]); $venueID = unserialize($show_meta_data['artistpress_show_venue'][0]); $artistID = $artistID[0]; $venueID = $venueID[0]; $artistName = esc_html( get_the_title($artistID) ); $artistPermalink = get_the_permalink($artistID); $venueName = esc_html( get_the_title($venueID) ); $venuePermalink = get_the_permalink($venueID); $venueStreet = esc_html( get_post_meta($venueID, 'artistpress_venue_address', true)); $venueCity = esc_html( get_post_meta($venueID, 'artistpress_venue_city', true)); $venueState = esc_html( get_post_meta($venueID, 'artistpress_venue_state', true)); $venuePostal = esc_html( get_post_meta($venueID, 'artistpress_venue_postal_code', true)); $venueCountry = esc_html( get_post_meta($venueID, 'artistpress_venue_country', true)); $venueWebsite = esc_html( get_post_meta($venueID, 'artistpress_venue_website', true)); $venuePhone = esc_html( get_post_meta($venueID, 'artistpress_venue_telephone', true)); $venueAddress = $venueStreet . '
' . $venueCity . ', ' . $venueState . ' ' . $venuePostal; if ($showListDisplay == 'show_date'){ if ($showDate != $current_meta_value){ $shortcodeContent .= '

' . $showDate . '

'; } } elseif ($showListDisplay == 'show_venue'){ if ($venueName != $current_meta_value){ $shortcodeContent .= '

' . $venueName . '

'; } } elseif ($showListDisplay == 'show_artist'){ if ($artistName != $current_meta_value){ $shortcodeContent .= '

' . $artistName . '

'; } } $shortcodeContent .= '
'; if ($showListDisplay == 'show_date'){ if ($showDate != $current_meta_value){ $shortcodeContent .= '
'; if( $showDisplayArtistName == 'yes' ) { $shortcodeContent .= '
Artist
'; } if( $showDisplayVenueName == 'yes' ) { $shortcodeContent .= '
Venue
'; } $shortcodeContent .= '
City
'; $shortcodeContent .= '
'; } } elseif ($showListDisplay == 'show_venue'){ if ($venueName != $current_meta_value){ $shortcodeContent .= '
'; $shortcodeContent .= '
Date
'; if( $showDisplayArtistName == 'yes' ) { $shortcodeContent .= '
Artist
'; } $shortcodeContent .= '
City
'; $shortcodeContent .= '
'; } } elseif ($showListDisplay == 'show_artist'){ if ($artistName != $current_meta_value){ $shortcodeContent .= '
'; $shortcodeContent .= '
Date
'; if( $showDisplayVenueName == 'yes' ) { $shortcodeContent .= '
Venue
'; } $shortcodeContent .= '
City
'; $shortcodeContent .= '
'; } } $shortcodeContent .= '
'; if ($showListDisplay == 'show_date'){ if ( $showDisplayArtistName == 'yes' ){ $shortcodeContent .= '
' .$artistName . '
'; } if ( $showDisplayVenueName == 'yes' ) { $shortcodeContent .= '
' . $venueName . '
'; } $shortcodeContent .= '
' . $venueCity . ', ' . $venueState . '
'; } elseif ($showListDisplay == 'show_venue'){ $shortcodeContent .= '
' . $showDate . '
'; if ( $showDisplayArtistName == 'yes' ){ $shortcodeContent .= '
' .$artistName . '
'; } $shortcodeContent .= '
' . $venueCity . ', ' . $venueState . '
'; } elseif ($showListDisplay == 'show_artist'){ $shortcodeContent .= '
' . $showDate . '
'; if ( $showDisplayVenueName == 'yes' ) { $shortcodeContent .= '
' . $venueName . '
'; } $shortcodeContent .= '
' . $venueCity . ', ' . $venueState . '
'; } if ( $showDisplayInfoBut == 'yes' ){ $shortcodeContent .= '
'; if ( $showInfoButLabel ){ $shortcodeContent .= ''. $showInfoButLabel .''; }else{ $shortcodeContent .= 'Additional Info'; } $shortcodeContent .= '
'; } if ($showDisplayTicketBut == 'yes' ){ if ( $showTicketWeb != NULL ){ $shortcodeContent .= '
'; if ( $showTicketButLabel ){ $shortcodeContent .= ''. $showTicketButLabel .''; }else{ $shortcodeContent .= 'Get Tickets'; } $shortcodeContent .= '
'; } } $shortcodeContent .= '
'; if ($showListDisplay == 'show_date'){ $current_meta_value = $showDate; } elseif ($showListDisplay == 'show_venue'){ $current_meta_value = $venueName; } elseif ($showListDisplay == 'show_artist'){ $current_meta_value = $artistName; } $shortcodeContent .= '
'; } wp_reset_postdata(); } else { $shortcodeContent .= '

Sorry, No Shows Have Been Scheduled.

'; } $shortcodeContent .= '
'; return $shortcodeContent; }