Page title for events page

Home Forums Calendar Products Events Calendar PRO Page title for events page

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #937975
    Nick
    Participant

    Hi,

    Is there a way of setting a page title for the events page? The normal way of doing it in WordPress is it’s based off the title you give in the admin area when creating a new page – but this can’t be done.

    How would you suggest it’s done?

    Thanks.

    #938094
    Geoff
    Member

    Hello there, Nick! Thanks for getting in touch.

    Good question and the answer is yes, that can be done. Here’s an example of a snippet that changes the page title when the calendar is in Week View.

    Of course, it doesn’t just have to be Week View. Here’s a good example of all the different conditionals that are available to target the specific view/page you are looking for.

    Does this help answer your question? Please let me know. 🙂

    Cheers!
    Geoff

    #938112
    Nick
    Participant

    Hi,

    Very useful, thanks, however, it’s the main events/calendar page/view that I need the title for. All the ‘inner views’ (so to speak) like single events page, list view etc.. are all ok and display the relevant page title.

    If you go to ‘http://www.midlandkarting.co.uk/events’ and look at the page title, anything before | should display the individual page title like on other pages.

    The code you supplied doesn’t seem to fix this, even though it should?

    Thanks.

    #938122
    Geoff
    Member

    Hey Nick–thanks for following up!

    My bad. By “page title” I thought you were referring the the content on the page rather than the title bar in the browser. Sorry about that and thanks for clarifying!

    The second link in my last response should get you what your looking for. Those snippets do in fact modify the title attribute and provide examples for all conditions in which it can be applied.

    Cheers!
    Geoff

    #938147
    Nick
    Participant

    There was only one link? Which was this: http://pastebin.com/QU2aMwBJ

    Which was the code I followed, as it was targeting the <title> tag, but it didn’t seem to work correctly?

    #938152
    Geoff
    Member

    Oh strange, my first response is missing an entire paragraph. My apologies!

    I just tried this snippet on my local setup and it seemed to do the trick:

    add_filter('tribe_events_title_tag', 'filter_events_title');
    
    function filter_events_title ($title) {
    if ( tribe_is_month() ) { // Month View
    $title = 'Your Page Title | Midland Karting';
    }
    
    return $title;
    
    }

    Does that work for you as well?

    Geoff

    #938209
    Nick
    Participant

    No luck here. It could be to do with how the theme generates the page title, but I’m not convinced as it all seems standard. Especially as the other page titles work on the ‘inner pages’.

    The default view is the current month view, but on future months the correct page title is present and correct.

    #938214
    Nick
    Participant

    Additionally, and to confuse matters even more, I’ve tried both 2014 default WordPress theme and the theme on my localhost install and they both display “Events for January” as the page title. But, on the live site, the page title doesn’t appear.

    #938318
    Geoff
    Member

    Interesting, so everything works properly when using a default WordPress theme and on your local installation, correct?

    If so, that certainly sounds like a configuration on your live site has gone awry, whether that’s how the theme generates page titles or something else.

    Will you please try following the steps in our Testing for Conflicts Guide to see if we can pinpoint the issue to a conflict with either the theme or one of the other installed plugins?

    For what it’s worth, the page title displays properly on my local install when the calendar is set to Month View by default. You can see the same thing working on our demo site as well.

    Let me know what you find, and we’ll go from there. 🙂

    Cheers!
    Geoff

    #938654
    Nick
    Participant

    Hi,

    Thanks for the links.

    Have a had a look through and tried it out on my localhost test site install. Found no problems. The page title appears fine, as it should be. I did find a previous conflict with the All in One SEO Pack, but that was resolved by reverting back to a previous version of that plugin, but it wasn’t related to the page title.

    However, the problem only occurs on the live site.

    The 2 are the same, running the same versions, although I can only have the default permalinks on there, rather than the ‘seo friendly’ setting that’s on the live site.

    #938668
    Geoff
    Member

    I think we’re getting closer–thanks for the extra info!

    What happens when you use default permalinks? Do you see a difference?

    There’s clearly some setting between the local site and the live site that is causing this pop up. The good news is that there is no bug to squish, but the trick is to find what that setting is.

    Cheers!
    Geoff

    #938720
    Nick
    Participant

    It’s the permalinks settings.
    Just tried it on the live site.

    On default, the page title displays fine. With the permalinks set to ‘Post Name’, the page title disappears.

    #938809
    Geoff
    Member

    Excellent! Nice work pinning it down to the permalinks setting.

    What that’s telling us is that there is something going on at the theme level that’s preventing the page title from displaying. In fact, when I view the site, I get the following error in the console:

    Uncaught TypeError: undefined is not a function (main.js: 44)

    Also, I get the following error when trying to skip to the next month of the calendar:

    Failed to load resource: http://www.midlandkarting.co.uk/wp-admin/admin-ajax.php

    Are you able to clear out those errors? In particular, the calendar heavily relies on AJAX and having it load twice can have adverse affects.

    Cheers!
    Geoff

     

    #938858
    Nick
    Participant

    The main.js error is nothing to worry about. There’s a bunch of js calls in one file to save embedding lots of js files into the pages (to improve site load time by combining files). It’s just trying to call a jQuery script function, but the script that contains the function isn’t loaded on that page.

    The code to change the page title works with the theme on my localhost with default permalinks, so, I’m unsure on how the theme is the source of the issue?

    The failed resource – why is an admin file been called when a user, such as yourself, that isn’t an admin visits the site?

    #938905
    Geoff
    Member

    I think any error logged in the console is worth looking into, whether the function seems to be applicable or not. Those things often are the source of unintended consequences, at least from we typically see here in the forums.

    The code to change the page title works with the theme on my localhost with default permalinks

    There has to be some sort of difference between what is configured on the local installation and the live site, whether that is in the theme configurations, the WordPress configurations or the plugin configurations. The fact that it is only happening on your live site and we’ve been unable to replicate it on either of our local setups or the demo, I think we’re left with something that is unique to the live site.

    In this case, I wonder if it’s possible that the hosting could be playing a role here. That seems to be the unique difference between all the sites we’ve tested together.

    The failed resource – why is an admin file been called when a user, such as yourself, that isn’t an admin visits the site?

    That’s a good question.The WordPress Ajax API requires it to be used for any Ajax calls. Are you running any security plugins that would prevent it from loading?

    Cheers!
    Geoff

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Page title for events page’ is closed to new replies.