From 78987200331b2e165ab4e8351d401b1b13d8e6fa Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 18 Sep 2017 08:45:51 -0400 Subject: [PATCH] Update for getting event detail page title. This is for themes that have the title in separate area from the page content. --- setup/frontHooks.php | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/setup/frontHooks.php b/setup/frontHooks.php index b9e1399..4e55154 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -113,6 +113,56 @@ add_filter('query_vars', function($vars) { return $vars; }); +function glm_get_event_name( $id = 0 ) { + global $wpdb; + if ( $id ) { + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE id = %d", + $id + ) + ); + } + if ( !isset( $GLOBALS['glmDetailSlug'] ) || !$GLOBALS['glmDetailSlug'] ) { + return false; + } + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE name_slug = %s", + $GLOBALS['glmDetailSlug'] + ) + ); +} + +function glm_is_event_detail( $id = 0 ) { + global $wpdb; + if ( $id ) { + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE id = %d", + $id + ) + ); + } + if ( !isset( $GLOBALS['glmDetailSlug'] ) || !$GLOBALS['glmDetailSlug'] ) { + return false; + } + return $wpdb->get_var( + $wpdb->prepare( + "SELECT id + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE name_slug = %s", + $GLOBALS['glmDetailSlug'] + ) + ); +} + if (isset($this->config['addOns']['glm-member-db'])) { // // Add content to member listing page - Get it from the existing package listing shortcode -- 2.17.1