summaryrefslogtreecommitdiffstats
path: root/includes/giglogadmin-shortcodes.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-01-29 15:40:18 +0100
committerHarald Eilertsen <haraldei@anduin.net>2023-01-29 15:40:18 +0100
commit0d7a4542ef0c0114ae9788c83df80993449b18ce (patch)
treeaf30ff17f2b0c04181a6c27ec03775affafb9e2d /includes/giglogadmin-shortcodes.php
parent2d2fe8402a57034f92a44b4be13d3124753e0293 (diff)
downloadgigologadmin-0d7a4542ef0c0114ae9788c83df80993449b18ce.tar.gz
gigologadmin-0d7a4542ef0c0114ae9788c83df80993449b18ce.tar.bz2
gigologadmin-0d7a4542ef0c0114ae9788c83df80993449b18ce.zip
Add filters to shortcode concert table.
Diffstat (limited to 'includes/giglogadmin-shortcodes.php')
-rw-r--r--includes/giglogadmin-shortcodes.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/includes/giglogadmin-shortcodes.php b/includes/giglogadmin-shortcodes.php
index 053e297..8e410b2 100644
--- a/includes/giglogadmin-shortcodes.php
+++ b/includes/giglogadmin-shortcodes.php
@@ -22,11 +22,20 @@ if ( ! function_exists( 'giglogadmin_shortcode_public' ) ) {
* This shortcode does not have any attributes.
*/
function giglogadmin_shortcode_public() : string {
- $opts = array(
+ $filters = array(
'offset' => 0,
'limit' => 15,
);
- $concerts = GiglogAdmin_Concert::find_concerts( $opts );
+
+ if ( isset( $_GET['city'] ) && ! empty( $_GET['city'] ) ) {
+ $filters['city'] = sanitize_text_field( wp_unslash( $_GET['city'] ) );
+ }
+
+ if ( isset( $_GET['venue'] ) && ! empty( $_GET['venue'] ) ) {
+ $filters['venue'] = sanitize_text_field( wp_unslash( $_GET['venue'] ) );
+ }
+
+ $concerts = GiglogAdmin_Concert::find_concerts( $filters );
ob_start();
include __DIR__ . '/templates/giglogadmin-concerts-table.php';