Change page title in browser tab

Home Forums Calendar Products Events Calendar PRO Change page title in browser tab

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1159782
    fabrice ferries
    Participant

    Hi,

    I would like to change the page title in the browser tab for single events. I tried this :
    function filter_events_title ($title) {
    if ( tribe_is_event() && is_single() ) { // Single Events
    $title = ‘Single event page’;
    }
    return $title;
    }
    It works but i still have “Next event – Single event page”.
    I just want to remove this first part : “next event -” and simply display the event title.
    How can i do that ?

    Thanks team for your help, and the good job with this plugin !

    #1160024
    Cliff
    Member

    Hi Fabrice.

    Thanks for your question.

    Could you please provide a link to a sample page so I can look further into this?

    #1160029
    fabrice ferries
    Participant

    Sure, it’s on this page :
    http://theatre-sorano.fr/spectacle/timon-titus/2016-11-02/

    please notice that i tryed with twenty fourteen and all plugins desactived

    #1160053
    Cliff
    Member

    Thanks for that.

    I saw the browser tab’s title is “Prochains Évènements Timon / Titus : Théâtre SORANO – Toulouse”, which is located at <head><title> within the page’s source code.

    A recurring event from our Demo Site — http://wpshindig.com/event/js-study-group-algorithms/2016-09-05/ — has the title “Upcoming Events | JS Study Group: Algorithms | WP Shindig!”

    Therefore, I believe the “Prochains” (translation for “Upcoming”) is correct.

    However, if you’re still wanting to customize it, please provide the missing line of code you’re using, like add_filter( '___', 'filter_events_title' );

    #1160067
    fabrice ferries
    Participant

    Ok Cliff, thanks for your help.
    Yep, the translation is correct but this title is too long and ugly in particular if you share it on social medias…

    So yes i would like to cutomize it.

    my code is like this :

    add_filter('wp_title', 'filter_events_title');
    function filter_events_title ($title) {
    if ( tribe_is_event() && is_single() ) { // Single Events
    $title = ‘Single event page’;
    }
    return $title;
    }

    I tryed to replace the first line by your code, but didn’t worked.
    where to put “add_filter( ‘___’, ‘filter_events_title’ );” ?

    #1160072
    Cliff
    Member

    Fabrice, the “Upcoming Events…” text comes from tribe_get_events_title()

    Therefore, you can use the tribe_get_events_title filter to do str_replace() or whatever else you want to with it.

    You could look through some other people’s gists on this topic for inspiration too.

    I hope this helps!

    #1160075
    fabrice ferries
    Participant

    Find it in your link :

    add_filter('tribe_get_events_title', 'change_events_title');
    function change_events_title($title) {
      return '';
    }

    Thank u Cliff !

    #1160340
    Cliff
    Member

    Thanks so much for letting me know you got it resolved!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Change page title in browser tab’ is closed to new replies.