- This topic has 13 replies, 2 voices, and was last updated 3 years, 3 months ago by Tom.
-
AuthorPosts
-
June 20, 2018 at 8:32 am #604490Antal
Hi,
I would love to have a GP Page Header for my events, that display the title of the event. (And possibly the date and time). The regular tags {{title}} don’t work on these event pages. I hope you can enlighten me? π
Example: https://3.bn1.nl/event/tristique-malesuada/I have found this, but can not seem to get it working. https://docs.generatepress.com/article/page-header-template-tags/
Thanks a million!
June 20, 2018 at 9:44 am #604547TomLead DeveloperLead DeveloperHi there,
Looks like we can use this function: https://theeventscalendar.com/function/tribe_get_events_title/
We just need to add it to a shortcode:
add_shortcode( 'events_title', function() { return function_exists( 'tribe_get_events_title' ) ? tribe_get_events_title() : ''; } );
Then use
[events_title]
in your Page Header.Let me know π
June 20, 2018 at 9:57 am #604560AntalThanks Tom, this comes back as ‘aankomende events’ (coming events), not the title of the event.
June 20, 2018 at 10:01 am #604564TomLead DeveloperLead DeveloperWhat does
{{post_title}}
output?June 20, 2018 at 10:01 am #604565AntalI added it again Tom, it works now! (dont know what was wrong before)
Is there, by any chance, also a similar solution for the date/time?
Thanks πJune 20, 2018 at 10:03 am #604568TomLead DeveloperLead DeveloperYou should be able to use the standard date/time template tags as well if
{{post_title}}
works.June 20, 2018 at 10:05 am #604571AntalNeither {{post_title}} or any other tags work with Event pages.
June 20, 2018 at 10:10 am #604575TomLead DeveloperLead DeveloperAh, the shortcode I provided is the one that’s working?
June 20, 2018 at 10:11 am #604577AntalYes, the code snippet, plus [events_title] work. The title is now glorious present in the header. π
(now only, if possible, the date/time)June 20, 2018 at 7:53 pm #604870TomLead DeveloperLead DeveloperTry these:
add_shortcode( 'events_start_time', function() { return function_exists( 'tribe_get_start_date' ) ? tribe_get_start_date() : ''; } ); add_shortcode( 'events_end_time', function() { return function_exists( 'tribe_get_end_date' ) ? tribe_get_end_date() : ''; } );
December 20, 2020 at 9:02 am #1588309NeilHi,
I have been able to display only this title, “Upcoming Events” and the current time in the page-hero header element. I want to display the event post title and my custom taxonomy or at the least eventscalendar categories and tags in the header as well but don’t see how to do that.
I am using the page hero header element on a custom post type and posts and would like to have eventscalendar header look the same. I was able to reposition the event post title into the header and the featured image is displaying but not the metadata. Is this possible with eventscalendar?
December 20, 2020 at 11:18 am #1588414TomLead DeveloperLead DeveloperHi there,
Did you try these shortcodes?: https://generatepress.com/forums/topic/the-event-calendar-title-in-page-headers/#post-604870
They should display the start and end times (according to their docs) – not the current time.
December 20, 2020 at 11:52 am #1588441NeilHi Tom,
Yes, I tried them – put them in my functions file and called the shortcode from the Single Post Header. Still just returns the current time. And I also tried to return the post title but it is giving me the archive title I believe, “Upcoming Events”.
December 21, 2020 at 10:57 am #1589735TomLead DeveloperLead DeveloperYou may need to check with their support on why those shortcodes wouldn’t be outputting the correct data. It’s possible that there’s something additional we need to do in order to get the correct info outside of the loop.
-
AuthorPosts
- You must be logged in to reply to this topic.