What is the page title filter?

Home Forums Calendar Products Events Calendar PRO What is the page title filter?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #526985
    Nicholas Rios
    Participant

    Sorry, it’s been a second since I had to do some editing on this plugin, and I can’t find my way quickly to it in the plugin, nor can I find any examples on it using the search.

    Is there a filter I can use to edit the page title?

    I am trying to get it to say “Calendar – %sitename” instead of “Events – %sitename”

    #528263
    Barry
    Member

    Hi!

    You may need to tweak things to better fit your specific needs, but essentially a small snippet like this (operating on the wp_title filter hook) should work:

    add_filter( 'wp_title', 'modify_the_title', 50 );
    
    function modify_the_title( $title ) {
        return str_replace( 'Events', 'Calendar', $title );
    }

    Does that help/get you started in the right direction at least?

    #533652
    Nicholas Rios
    Participant

    Thank you, that does help, but I was hoping for a little bit of insight into where ECP is filtering wp_title itself, and hoping I could modify ECP’s title filtering.

    I have found the function maybeAddEventTitle and can use the tribe_events_add_title filter. But this does not actually filter the ECP landing page title (the default calendar view), which shows as “Events >> %sitename” where %sitename is the actual site’s name.

    #540169
    Barry
    Member

    I have found the function maybeAddEventTitle and can use the tribe_events_add_title filter. But this does not actually filter the ECP landing page title (the default calendar view), which shows as “Events >> %sitename”

    Hmm, I’m not sure there is any other place … might a side effect of another plugin/your theme be at work here?

    YES, I’ve deactivated all other plugins to check for a plugin conflict.
    YES, I’ve reverted to the 2011 default WordPress theme (with other plugins still deactivated) to check for a theme conflict.

    I see you carried out the above steps which is great: can you confirm the title remained as Events » %sitename even under those conditions, rather than (for example) Upcoming Events | %sitename or Events for (date) | %sitename?

    Thanks!

    #548258
    Nicholas Rios
    Participant

    OK you caught me. Here are the various situations:

    1- 2014 WP Theme, no other plugins: “Events this month | %sitename” on landing page calendar, otherwise (navigating in calendar): “Events for (date) | %sitename”
    2- 2014 WP Theme, add WordPress SEO plugin: “Events | %sitename” on landing page calendar, otherwise: “Events for (date) | %sitename”
    3- Genesis child theme (tested with just framework as well) activated, no other plugins: “Events this month” on landing page calendar, otherwise: “Events for (date)” (no sitename on either)
    4- Genesis child theme, WordPress SEO: “Events – %sitename”, otherwise “Events for (date) |” (missing sitename on second)

    I’m not sure where the >> separator came from, or where it went. My original hope was to just replace where the word “Events” wherever it was entered in by ECP. I’m kind’ve confused where the simple “Events” one is coming from because I don’t see it even as an option in the plugin (only variations of it with the date).

    Thanks for looking into it Barry.

    #548641
    Nicholas Rios
    Participant

    https://theeventscalendar.com/support/forums/topic/yoast-ecl/

    This contains the solution, specifically a variation of: https://gist.github.com/jo-snips/3710617

    If I wasn’t only trying to change the main page, what I think I would do is filter wpseo_title with the above code combined with maybeAddEventTitle.

    #550492
    Barry
    Member

    OK, great – so you’re all sorted here?

    #556815
    Nicholas Rios
    Participant

    Got it, thanks.

    #557744
    Barry
    Member

    Awesome 🙂

    I’ll go ahead and close this thread in that case but please do feel free to create new ones if you need assistance with anything else.

    Thanks again!

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘What is the page title filter?’ is closed to new replies.