Change Single Event Page Title

Home Forums Calendar Products Events Calendar PRO Change Single Event Page Title

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #822223
    sean
    Participant

    Hi there. I’m trying to remove “Upcoming Events” from the page title of our single event pages (so that only the event title is in the page title). I’m aware that in the-events-calender/lib/tribe-template-factory.class.php there’s a function (title_tag) with a filter that I can use to change the tile, but being a novice with PHP, I’m not sure how to go about creating that for inclusion in my functions.php file.

    Is there an example of this type of modification available? Thank you.

    #822906
    Brian
    Keymaster

    Sure I can help with that.

    Using the function from line 296 from this file that I have mentioned before:

    the-events-calender/lib/tribe-template-factory.class.php

    I created this filter:

    https://gist.github.com/jesseeproductions/3f91775fa341b35f0dd4

    That should get you close you may have to modify it to get it exactly how you would like.

    #823042
    sean
    Participant

    Thanks Brian! This definitely helps me better understand how to create this type of filter. I was able to make a slight modification to get only the event title displaying. Appreciate the quick response and for lesson on how to do this!

    #823114
    sean
    Participant

    Looks like I may have jumped the gun Brian.

    I tried using the filter that you had provided but it didn’t remove “Upcoming Events” from the single event page titles. So I tried seeing if any text would replace “Upcoming Events ” or “Upcoming Events |” but I had no luck there either: http://pastebin.com/2JFQ1kZV

    Using your filter and changing “return $title_filter” to “return $new_title” did display only the event title on single event pages, but obviously caused all other page titles to be blank.

    I’m sure I must be doing something wrong at the most basic level…I’m using str_replace in other filters to successfully replace text elsewhere on my site. So I’m stumped as to why this isn’t removing the text from the single event pages:
    $title_filter = str_replace('Upcoming Events ', '', $title_filter);

    #824339
    Brian
    Keymaster

    So I retested the snippet this morning and it is working for me still on my site. I also tried your snippet in Pastebin and it worked for me as well.

    I looked at the coolrunnings site and see the title tag for a event is “<title>Upcoming Events Roger Williams National Memorial Weekly Wednesday 5K Fun Run</title>”

    So there is not bar separating the titles. So maybe there is some other coding that is conflicting with this and causing the issue?

    Maybe if you increase the 10 in this hook:

    add_filter(‘tribe_events_title_tag’, ‘ecp_filter_single_title’, 10, 4);

    To something higher it will run after the other function.

    There is not much we can do to help on this as it does not on a standard install without any customizations on it.

    You could try commenting out any other customizations you have for titles and see if that makes a difference too.

    #825232
    sean
    Participant

    Thanks for retesting Brian. I’ll need to dig deeper and try to determine what is preventing the title from being replaced. Appreciate the suggestions.

    #826782
    Brian
    Keymaster

    No Worries.

    Closing out this ticket, but if you have any other issues related to this or something new, please create a new one.

    Thanks

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Change Single Event Page Title’ is closed to new replies.