diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php
index 456b7998..d0b4ebc5 100644
--- a/includes/admin/post-types/class-sp-admin-meta-boxes.php
+++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php
@@ -139,6 +139,13 @@ public function __construct() {
'context' => 'side',
'priority' => 'default',
),
+ 'ticketshop' => array(
+ 'title' => esc_attr__( 'Ticketshop', 'sportspress' ),
+ 'save' => 'SP_Meta_Box_Event_Ticketshop::save',
+ 'output' => 'SP_Meta_Box_Event_Ticketshop::output',
+ 'context' => 'side',
+ 'priority' => 'default',
+ ),
'team' => array(
'title' => esc_attr__( 'Teams', 'sportspress' ),
'save' => 'SP_Meta_Box_Event_Teams::save',
diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-ticketshop.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-ticketshop.php
new file mode 100644
index 00000000..b8ff5996
--- /dev/null
+++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-ticketshop.php
@@ -0,0 +1,43 @@
+ID, 'sp_ticketshop_link', true );
+
+ ?>
+
+ 'event_options',
),
),
+ array(
+ array(
+ 'title' => esc_attr__( 'Ticketshop', 'sportspress' ),
+ 'type' => 'title',
+ 'desc' => '',
+ 'id' => 'ticketshop_options',
+ ),
+ ),
+ apply_filters(
+ 'sportspress_ticketshop_options',
+ array(
+ array(
+ 'title' => esc_attr__( 'Ticketshop label', 'sportspress' ),
+ 'id' => 'sportspress_ticketshop_label',
+ 'default' => 'Get your ticket',
+ 'type' => 'text',
+ ),
+
+ array(
+ 'title' => esc_attr__( 'Past events', 'sportspress' ),
+ 'desc' => esc_attr__( 'Hide ticketshop for past events', 'sportspress' ),
+ 'id' => 'sportspress_ticketshop_hide_past_events',
+ 'default' => 'yes',
+ 'type' => 'checkbox',
+ ),
+
+
+ )
+ ),
+ array(
+ array(
+ 'type' => 'sectionend',
+ 'id' => 'event_options',
+ ),
+ ),
array(
array(
'title' => esc_attr__( 'Venues', 'sportspress' ),
diff --git a/includes/class-sp-ajax.php b/includes/class-sp-ajax.php
index 91a66c5f..e1165b64 100644
--- a/includes/class-sp-ajax.php
+++ b/includes/class-sp-ajax.php
@@ -629,6 +629,7 @@ public function event_list_shortcode() {
'league' => esc_attr__( 'League', 'sportspress' ),
'season' => esc_attr__( 'Season', 'sportspress' ),
'venue' => esc_attr__( 'Venue', 'sportspress' ),
+ 'ticketshop' => esc_attr__( 'Ticketshop Link', 'sportspress' ),
'article' => esc_attr__( 'Article', 'sportspress' ),
'event_specs' => esc_attr__( 'Specs', 'sportspress' ),
);
diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php
index 4db7303d..ed34db52 100644
--- a/includes/class-sp-event.php
+++ b/includes/class-sp-event.php
@@ -41,6 +41,11 @@ public function mode() {
return $mode;
}
+ public function ticketshop_link() {
+ $ticketshop_link = get_post_meta( $this->ID, 'sp_ticketshop_link', true );
+ return $ticketshop_link;
+ }
+
public function minutes() {
$minutes = get_post_meta( $this->ID, 'sp_minutes', true );
if ( '' === $minutes ) {
diff --git a/includes/class-sp-templates.php b/includes/class-sp-templates.php
index 1d79ac85..848b39b3 100644
--- a/includes/class-sp-templates.php
+++ b/includes/class-sp-templates.php
@@ -82,6 +82,12 @@ public function __construct() {
'action' => 'sportspress_output_event_performance',
'default' => 'yes',
),
+ 'ticketshop_link' => array(
+ 'title' => esc_attr__( 'Ticketshop link', 'sportspress' ),
+ 'option' => 'sportspress_event_show_ticketshop_link',
+ 'action' => 'sportspress_output_event_show_ticketshop_link',
+ 'default' => 'no',
+ ),
)
)
),
diff --git a/includes/sp-template-functions.php b/includes/sp-template-functions.php
index 176254d3..ae115b87 100644
--- a/includes/sp-template-functions.php
+++ b/includes/sp-template-functions.php
@@ -61,6 +61,10 @@ function sp_body_class( $classes ) {
$classes[] = 'sp-has-results';
}
}
+ $show_ticketshop_link = get_option( 'sportspress_event_show_ticketshop_link', 'yes' ) == 'yes' ? true : false;
+ if ( $show_ticketshop_link && get_post_meta( $id, 'ticketshop_link', true ) ) {
+ $classes[] = 'sp-has-ticketshop-link';
+ }
$classes[] = 'sp-performance-sections-' . get_option( 'sportspress_event_performance_sections', -1 );
} elseif ( 'sp_team' == $post_type && 'yes' == get_option( 'sportspress_team_show_logo', 'yes' ) ) {
$classes[] = 'sp-show-image';
@@ -204,6 +208,19 @@ function sportspress_output_event_performance() {
sp_get_template( 'event-performance.php' );
}
}
+if ( ! function_exists( 'sportspress_output_event_show_ticketshop_link' ) ) {
+
+ /**
+ * Output the event Ticketshop link.
+ *
+ * @access public
+ * @subpackage Event/Ticketshop
+ * @return void
+ */
+ function sportspress_output_event_show_ticketshop_link() {
+ sp_get_template( 'event-ticketshop-link.php' );
+ }
+}
if ( ! function_exists( 'sportspress_output_event_officials' ) ) {
/**
diff --git a/templates/event-list.php b/templates/event-list.php
index 41f316f7..e05140bc 100644
--- a/templates/event-list.php
+++ b/templates/event-list.php
@@ -40,6 +40,9 @@
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
'rows' => get_option( 'sportspress_event_list_rows', 10 ),
+ 'ticketshop_link' => null,
+ 'ticketshop_label' => get_option( 'sportspress_ticketshop_label'),
+ 'ticketshop_hide_past' => get_option( 'sportspress_ticketshop_hide_past_events', 'yes' ) == 'yes' ? true : false,
'order' => 'default',
'columns' => null,
'show_all_events_link' => false,
@@ -223,6 +226,10 @@
echo '' . esc_attr__( 'Article', 'sportspress' ) . ' | ';
}
+ if ( sp_column_active( $usecolumns, 'ticketshop' ) ) {
+ echo '' . esc_attr__( 'Ticketshop', 'sportspress' ) . ' | ';
+ }
+
if ( sp_column_active( $usecolumns, 'day' ) ) {
echo '' . esc_attr__( 'Match Day', 'sportspress' ) . ' | ';
}
@@ -528,6 +535,21 @@
echo '';
endif;
+ if ( sp_column_active( $usecolumns, 'ticketshop' ) ) :
+ echo '';
+
+ if ($ticketshop_hide_past && $event->post_status != 'future' ) {
+ echo '';
+ } else {
+ $ticketshop_link = get_post_meta( $event->ID, 'sp_ticketshop_link', true );
+ if(isset($ticketshop_link) && $ticketshop_link != '') {
+ echo ''.$ticketshop_label.'';
+ }
+ }
+
+ echo ' | ';
+ endif;
+
if ( sp_column_active( $usecolumns, 'day' ) ) :
echo '';
$day = get_post_meta( $event->ID, 'sp_day', true );
diff --git a/templates/event-ticketshop-link.php b/templates/event-ticketshop-link.php
new file mode 100644
index 00000000..496e6366
--- /dev/null
+++ b/templates/event-ticketshop-link.php
@@ -0,0 +1,52 @@
+ticketshop_link();
+ $hide_past_events = get_option( 'sportspress_ticketshop_hide_past_events', 'yes' ) == 'yes' ? true : false;
+
+ if ($hide_past_events && $post->post_status != 'future' ) {
+ return;
+ }
+
+ if(isset($ticketshop_link) && $ticketshop_link != '') {
+ $ticketshop_label = get_option( 'sportspress_ticketshop_label');
+
+ ?>
+ Ticketshop
+
+
+
+
|