Update for getting event detail page title.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 18 Sep 2017 12:45:51 +0000 (08:45 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 18 Sep 2017 12:45:51 +0000 (08:45 -0400)
This is for themes that have the title in separate area from the page
content.

setup/frontHooks.php

index b9e1399..4e55154 100644 (file)
@@ -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