Home › Forums › Calendar Products › Events Calendar PRO › Custom SEO Titles and Meta Descriptions – Date Query
- This topic has 6 replies, 2 voices, and was last updated 12 years, 3 months ago by
Brook.
-
AuthorPosts
-
January 6, 2014 at 12:03 pm #87504
reshetramah
ParticipantI have gotten most of the title tags and meta descriptions to work in my favor thanks to the support team. Most recently, a thread was closed and I have one lingering question. I cannot seem to get the date query to work for an individual event.
“View detailed information about all events happening on: “date”” works fine and so does “Events on: “date”” but the individual event date 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: http://pastebin.com/EeLvdrfS
January 7, 2014 at 8:39 am #87820Brook
ParticipantHowdy again reshetramah,
I am glad that title code worked for you and that you are able to adapt it to meta stuff as well! I apologize for closing your topic, that was unintentional. I am glad you opened a new topic to continue our discussion.
Edit: I am sorry I just realized your post was about the variable eventDate not post_date. I will take a look at this.
– Brook
January 7, 2014 at 9:02 am #87835reshetramah
ParticipantHi again Brook! I posted on the wordpress forums and hopefully can find the answer to this there. The unanswered question from our last discussion (now marked resolved) was — When I land on the event page it registers the title tag but then defaults back to “”Upcoming Events>>”. Do you have any idea why this would be happening? You can see I call it out in our previous discussion.
https://tri.be/support/forums/topic/seo-with-custom-addition-to-functions-file/#post-87461
January 7, 2014 at 9:22 am #87839Brook
ParticipantHere we go. When viewing a single page the query vars are distinctly different. What you are looking for is the tribe_get_start_date() function, you no longer need to mess with $wp_query.
You might be interested in a PHP IDE. It points out basic coding errors like the lack of a global from before. In your current code you are returning the variable title, which has never been defined. This would cause a problem as well which an IDE will kindly point out.
Here is the corrected code: http://pastebin.com/n7dqCcsN
If you are writing creating further customization like the meta info, you will want to use our tutorials as a reference for our API: https://theeventscalendar.com/the-events-calendar-for-wordpress-tutorials/
In addition, in the future if you are looking for a specific function like tribe_get_start_date(), poking through the files in the folder \the-events-calendar\public\template-tags\ will give you a great set of available functions to use in your customizations.
I hope that helps. Thanks for posting!
– Brook
January 7, 2014 at 9:25 am #87842Brook
ParticipantReshetramah,
You may have missed my edit from above. I misread your comment from before. Hence my second reply (seen above) that helps correct the 1970 error.
Please let me know if that code works for you! I appreciate your patience.
– Brook
January 7, 2014 at 9:31 am #87849reshetramah
Participantthat worked! thank you so so much!
January 7, 2014 at 10:02 am #87860Brook
ParticipantYou are very welcome! I am going to mark this thread as answered since the issue is now resolved. If you have a different issue in the future feel free to post. We are glad to help point you in the right direction if you are doing some customizations, or if you are encountering an error or bug.
– Brook
-
AuthorPosts
- The topic ‘Custom SEO Titles and Meta Descriptions – Date Query’ is closed to new replies.
