diff options
-rw-r--r-- | includes/giglogadmin-shortcodes.php | 12 | ||||
-rw-r--r-- | includes/templates/giglogadmin-concerts-table.php | 70 |
2 files changed, 80 insertions, 2 deletions
diff --git a/includes/giglogadmin-shortcodes.php b/includes/giglogadmin-shortcodes.php index 5070a3e..69f46c4 100644 --- a/includes/giglogadmin-shortcodes.php +++ b/includes/giglogadmin-shortcodes.php @@ -22,8 +22,16 @@ if ( ! function_exists( 'giglogadmin_shortcode_public' ) ) { * This shortcode does not have any attributes. */ function giglogadmin_shortcode_public() : string { - $c = new GiglogAdmin_ConcertsTable(); - return $c->render(); + $opts = array( + 'offset' => 0, + 'recperpage' => 15, + ); + $concerts = GiglogAdmin_Concert::find_concerts( $opts ); + + ob_start(); + include __DIR__ . '/templates/giglogadmin-concerts-table.php'; + + return ob_get_clean(); } add_shortcode( 'getconcerts', 'giglogadmin_shortcode_public' ); diff --git a/includes/templates/giglogadmin-concerts-table.php b/includes/templates/giglogadmin-concerts-table.php new file mode 100644 index 0000000..f5ca911 --- /dev/null +++ b/includes/templates/giglogadmin-concerts-table.php @@ -0,0 +1,70 @@ +<?php +/** + * Template for public concerts table. + * + * @package giglogadmin + */ + +?> +<style> +.giglogadmin-concert { + margin-bottom: 1em; +} +.giglogadmin-concert > * { + padding: 2px; +} +.giglogadmin-concert-meta-row { + font-size: small; +} +.giglogadmin-concert-title-row { + background-color: #c17878; + color: white; + font-size: larger; +} +.giglogadmin-concert-links { + font-size: small; +} +</style> +<div class="giglogadmin-concerts-table"> +<?php foreach ( $concerts as $concert ) { ?> + <div class="giglogadmin-concert"> + <div class="giglogadmin-concert-title-row"> + <time datetime="<?php echo esc_attr( $concert->cdate()->format( 'c' ) ); ?>"> + <?php echo esc_html( $concert->cdate()->format( 'd.m.Y' ) ); ?> + </time> + — + <span class="giglogadmin-concert-title"> + <?php echo esc_html( $concert->cname() ); ?> + </span> + — + <span class="giglogadmin-concert-city"> + <?php echo esc_html( $concert->venue()->city() ); ?> + </span> + </div> + <div class="giglogadmin-concert-meta-row"> + <span class="giglogadmin-concert-venue"> + <?php echo esc_html( $concert->venue()->name() ); ?> + </span> + </div> + <div class="giglogadmin-concert-links"> + <span class="giglogadmin-event-link"> + <a href="<?php echo esc_url( $concert->eventlink() ); ?>"> + Event + </a> + </span> + | + <span class="giglogadmin-concert-ticket-link"> + <a href="<?php echo esc_url( $concert->tickets() ); ?>"> + Tickets + </a> + </span> + | + <span class="giglogadmin-concert-ical-link"> + <a href=""> + Add to calendar + </a> + </span> + </div> + </div> +<?php } ?> +</div> |