Changing how the event pages are titled in browser and FB shares etc (cont)

Home Forums Calendar Products Events Calendar PRO Changing how the event pages are titled in browser and FB shares etc (cont)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1088236
    justinbonnet
    Participant

    Howdy, 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! 🙂

    #1088665
    Nico
    Member

    Hey 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,
    Nico

    #1091676
    justinbonnet
    Participant

    Thanks 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 🙂

    #1091692
    justinbonnet
    Participant

    Howdy, 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’;
    }

    #1092148
    Nico
    Member

    Justin,

    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,
    Nico

    #1098400
    Support Droid
    Keymaster

    This 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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Changing how the event pages are titled in browser and FB shares etc (cont)’ is closed to new replies.