Display post date in meta description
-
I am using tribe events with the yoast seo plugin.
I have gotten most of the title tags and meta descriptions to work in my favor but, I cannot seem to get the date query to work for an individual event.
Meta descriptions for “View detailed information about all events happening on: “date”” work and so do the meta descriptions for “Events on: “date””. The problem is that the meta description for an individual event shows up as “January 1, 1970.”
elseif( tribe_is_event() && is_single() ) { // Single Events
return ‘Read more to see details about ‘ . get_the_title() . ‘ on ‘ . date(‘F j, Y’, strtotime($wp_query->query_vars[‘eventDate’])); shows up as“Read more to see details about Upper West Side Trivia on January 1, 1970″
Here is the code I am using: https://pastebin.com/EeLvdrfS
It was suggested to be that this is an issue with how Yoast handles meta info. Perhaps they are running this code outside of the main loop, thus the $wp_query post info has not yet been set?
- The topic ‘Display post date in meta description’ is closed to new replies.