Home › Forums › Calendar Products › Events Calendar PRO › Changing how the event pages are titled in browser and FB shares etc (cont)
- This topic has 5 replies, 3 voices, and was last updated 10 years ago by
Support Droid.
-
AuthorPosts
-
March 13, 2016 at 6:36 am #1088236
justinbonnet
ParticipantHowdy, picking up from this thread:
Changing how the event pages are titled in browser and FB shares etc
(sorry, didn’t get back to it in time!)
The info in those links is useful, but I haven’t been able to find the code I’m meant to be modifying – single-event.php and bar.php look promising, but I can’t find the relevant snippet there. All the references to ‘title’ in single-event.php seem to be about the name of the event displaying (such as in h1 in the header or in the previous/next events) rather than how it’s titled in the browser.
Thank you for any help you can give! 🙂
March 14, 2016 at 1:25 pm #1088665Nico
MemberHey Justin,
Thanks for reaching out to us!
We have a knowledge base article that covers this: Changing the browser title for calendar views. Please give a read and let me know about it,
Best,
NicoMarch 21, 2016 at 2:56 am #1091676justinbonnet
ParticipantThanks Nico, that’s very helpful! I’ll see if I can find a list of code snippets or whatever it is that I’ll need – I’ll let you know how I get on 🙂
March 21, 2016 at 4:10 am #1091692justinbonnet
ParticipantHowdy, hmm so the code from that snippet crashes the site when put into functions.php
Can you recommend a next best place for it? (There’s at least a handful of possible files, but I can’t tell the difference between the single event view on the calendar page, for example, or how an individual event page is made, or if that should be the default template page, or if its in the meta, etc…)
And, just so I understand, would I be pasting something like the below if I wanted the browser titles of individual event pages to display as the date of that day? (that isn’t quite what I want, but that then puts me on the correct track). Thankyou!
function filter_events_title( $title ) {
// Single events
if ( tribe_is_event() && is_single() ) {
$title = ‘$day’;
}March 21, 2016 at 7:31 pm #1092148Nico
MemberJustin,
Thanks for following up!
The snippet needs to be in your theme (or child theme) functions.php file, there’s no better place for it! I’m not quite sure about your code sample, it’a incomplete (maybe that wasn’t intended but pasting the code directly might have caused). This is a sample of how changing the day view title would work:
function filter_events_title_single( $title ) {
// Single events
if ( tribe_is_event() && is_single() ) {
$title = 'Single event page';
}return $title;
}
/**
*
* Users of Yoast's SEO plugin may wish to try replacing the below line with:
* add_filter('wpseo_title', 'filter_events_title_single' );
*/
add_filter( 'tribe_events_title_tag', 'filter_events_title_single' );
If the site crashes after adding this snippet to the functions.php you’ll need to check the server error log to see the error description. This sometimes happens when copying a code from the web browser, try pasting it into a plain text editor and then copy it over to you php file.
You mention adding the date is not quite what you need, Can you clarify a bit on that? What is the expected result?
Please let me know about it,
Best,
NicoApril 5, 2016 at 9:35 am #1098400Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Changing how the event pages are titled in browser and FB shares etc (cont)’ is closed to new replies.
