// Get the event name for use in the page title
global $wpdb;
- $GLOBALS['glmEventName'] = $wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events WHERE name_slug = '".$GLOBALS['glmDetailSlug']."'" );
+ $eventData = $wpdb->get_row(
+ "SELECT name,intro
+ FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events
+ WHERE name_slug = '".$GLOBALS['glmDetailSlug']."'",
+ ARRAY_A
+ );
+ $GLOBALS['glmEventName'] = $eventData['name'];
+ $GLOBALS['glmEventIntro'] = $eventData['intro'];
// Set the page title to the event name - Using low priority so it's the last to set the title!
- add_filter('wp_title', function($title) {
+ add_filter( 'wp_title', function($title) {
+ return $GLOBALS['glmEventName'];
+ }, 99, 1 );
+ add_filter( 'wpseo_opengraph_title', function($tag){
+ return $GLOBALS['glmEventName'];
+ }, 99, 1 );
+ add_filter( 'wpseo_opengraph_desc', function($tag){
+ return $GLOBALS['glmEventIntro'];
+ }, 99, 1 );
+ add_filter( 'wpseo_twitter_title', function($tag){
return $GLOBALS['glmEventName'];
- }, 99, 1);
+ }, 99, 1 );
+ add_filter( 'wpseo_twitter_description', function($tag){
+ return $GLOBALS['glmEventIntro'];
+ }, 99, 1 );
}
// Add eventslug query var