Template issue after updating from 3.6.1 to 3.9.1

Home Forums Calendar Products Events Calendar PRO Template issue after updating from 3.6.1 to 3.9.1

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #939362
    dominikborde
    Participant

    Hey Guys,

    I have a dev site running with some custom function to sort out missing page titles in my template – this was all working well and appears to work after the update, however I find the code is messing with my menus when I am viewing an event (they are fine in list/photo view) – the code I am using is:

    Use Template Title Area (Fixes missing Titles on Single Event and Calender views. Also fixes Upcoming/Past Events Titles.
    ================================================== */

    add_filter( ‘the_title’, ‘tribe_restore_title’ );

    function tribe_restore_title($title) {
    global $wp_query;
    global $post;

    if ( 0 !== $post->ID ) return $title;
    if ( ! isset( $wp_query->tribe_is_event ) || ! $wp_query->tribe_is_event ) return $title;
    if ( ! is_a( $wp_query->posts[0], ‘WP_Post’ ) || $wp_query->posts[0]->ID == $post->ID ) return $title;

    if ( is_singular() ) return $wp_query->posts[0]->post_title;

    if ( tribe_is_upcoming() ) {
    $title = __(‘Upcoming Events’, ‘tribe-events-calendar’);
    }

    else

    return tribe_get_events_title();
    }

    —->

    Not sure what has changed with your plugin for this to now occur – perhaps you can take a look?

    I also had 404 issues on certain views so had to disable them and just use photo view – I had determined this to be a WPML issue but having now disabled it (we will not require it so it will be removed) I still get 404’s on this version also. (I have not checked the 404 issue with plugins off but will do so asap, more concerned about the menu issue.

    #939527
    Barry
    Member

    Hi Dominik,

    Every theme is different and, looking back, we did spent quite a bit of time trying to work with you on this previously. With that in mind, I hope you can appreciate the level of assistance we can offer here is limited and it may also be worth considering seeking help from the theme author or even an independent developer.

    I’m tending to think that perhaps it’s time to adopt a different approach. If I understand correctly, the issue is in making the prominent page title (below the menu, but above the content) display the correct thing: maybe customizing the theme’s header.php template would be a better way to proceed here?

    You could potentially do this from a child theme and it may be a more reliable approach. Is that something you’d be happy to try?

    #939686
    dominikborde
    Participant

    This reply is private.

    #939714
    Barry
    Member

    Hi Dominik,

    I do indeed see the problem and can see how it’s impacting your menu. I can also appreciate this is a frustrating situation for you and we want to help as best we can – all I’m highlighting is that there are, reasonably enough, limits to the level of support we can provide.

    Bear in mind also that the reason you approached us in the first place is because your theme behaves in an atypical manner (I don’t believe you saw or would see the same issue with a default theme or any number of other themes), so we’re not necessarily looking at a flaw in our plugin here so much as an integration issue between the two products and, realistically, we can’t always provide fixes on demand in those situations.

    Not sure what you mean about changing the header? I have a page-events.php template in my child theme – this is where the $title stuff is

    So conventionally a theme will build up pages from multiple templates. Here’s a simplified example:

    • header.php (displays the browser title, page title, menu etc)
    • page.php (displays most of the actual post content)
    • footer.php (wraps things up)

    Every theme is different so they may not even have those particular templates (and the responsibilities of each vary on a theme-by-theme basis), but very often there will indeed by a header.php template and that will be where the title is printed out.

    What I’m suggesting here is locating that title area (if it’s not clear you could always seek the advice of the theme author in doing so – though perhaps you’ve already pinpointed it within page-events.php?) and modifying that in order to fix this in a different way from what was suggested previously, which isn’t looking like a suitable long-term fix.

    You can then use conditional tags to modify the title area output on different pages, something like this:

    <?php if ( tribe_is_month() ): ?>
        (Custom month view title)
    <?php elseif ( tribe_is_list_view() ): ?>
        (Custom list view title)
    <?php else: ?>
        <!-- theme's original title code which will -->
        <!-- behave as before in all other cases -->
    <?php endif ?>

    By making such a change directly in the relevant template (you can safely do so from a child theme) you will have what I think will be a far more robust solution.

    Does that make more sense?

    #939751
    dominikborde
    Participant

    Ok, I had already done something like this for all views other than the event view itself; that only works with the function – the code in my template is as follows, you will see I have successfully added the breadcrumbs also. Unfortunately http://docs.tri.be/ is timing out so not sure if there is an equivalent to the_title() such as tribe_get_events_title(); – i tried this but it doesn’t work:

    ——————————–>

    <?php if ($show_page_title) { ?>
    <div class=”row”>
    <div class=”page-heading span12 clearfix alt-bg <?php echo $page_title_bg; ?>”>
    <?php if ($page_title_one) { ?>
    <h1><?php echo $page_title_one; ?></h1>
    <?php } else { ?>
    <h1><?php // ADDS SUPPORT FOR THE EVENTS CALENDAR 3 VIEWS, FIXES MISSING TITLES ON MAP/LIST/DAY/WEEK VIEWS
    if(tribe_is_day()) {
    echo _e(“Events for”, “swiftframework”); echo ‘ ‘, tribe_event_format_date( $dateFormat = ‘F j, Y’, $displayTime = false );
    } else if(tribe_is_week()) {
    echo _e(“Events for the week of”, “swiftframework”); echo ‘ ‘ , $first_day_of_week = date(‘F j, Y’, strtotime(‘Last Monday’, time()));
    } else if(tribe_is_map()) {
    echo _e(“Event Locations”, “swiftframework”);

    // ENSURES THAT THE LIST VIEW TITLE DOES NOT REPLACE THE UPCOMING/PAST EVENT TITLES IN PHOTO VIEW
    } else if(tribe_is_photo()) {
    the_title();
    } else if(tribe_is_list_view()) {
    echo _e(“Events List”, “swiftframework”);

    // RETURNS DEFAULT TITLE IF NOT AN EVENTS VIEW (TEMPLATE STANDARD BEHAVIOUR)

    } else {
    the_title();
    } ?></h1>
    <?php } ?>
    <?php if ($page_title_one) { ?>
    <h3><?php echo $page_title_two; ?></h3>
    <?php } ?>
    </div>
    </div>
    <?php } // TRIBE BREADCRUMBS
    ?> <div class=”breadcrumbs-wrap row”>
    <div id=”breadcrumbs” class=”span12 alt-bg”><?php echo tribe_breadcrumbs();
    ?></div></div>

    —–>

    I have changed the_title() to: echo $wp_query->posts[0]->post_title; – and the breadcrumbs to:
    <?php echo tribe_breadcrumbs(); echo $wp_query->posts[0]->post_title;?>

    Seems to work though not sure if it is the best way! what do you think???

    #939799
    Barry
    Member

    docs.tri.be is unavailable at the moment, our apologies on that count (though it’s likely it will in any case ultimately be replaced completely by the new documentation available here at a future date) … and yes – we do indeed have a tribe_get_events_title() function 🙂

    So if you want to target single event pages in particular, how about adding in a conditional like this:

    if ( tribe_is_event_query() && is_singular() ) {
        echo tribe_get_events_title(); // and/or other code to suit
    } elseif {
        /** Other conditions, ... */
    }

    Does that get you closer?

    #939917
    dominikborde
    Participant

    Barry,

    Managed to get it all working, had to use the following and adjust the breadcrumb code in places (replacing Stitle):

    if ( tribe_is_event_query() && is_singular() ) {
    echo $wp_query->posts[0]->post_title;

    }

    echo tribe_get_events_title(); does work for the Upcoming/Past events titles when in Photo View – speaking of which, any idea how i would get the titles to change when clicking ‘past events’? – it appears that as you are reloading via ajax I would need to modify the title somehow so it reloads also?

    Thanks for all your help here, much appreciated!!!

    #939960
    Barry
    Member

    Awesome that first part is working 🙂

    any idea how i would get the titles to change when clicking ‘past events’? – it appears that as you are reloading via ajax I would need to modify the title somehow so it reloads also?

    One idea could be listening out for the reload event – via some custom Javascript – and updating things from there. There are probably a few hooks (I use “hooks” loosely here, not necessarily in the stricter WordPress sense of the word) that would allow you to inject the extra information you want to be used as the new title and breadcrumbs, and a custom JS handler could take things from there.

    Unfortunately, this level of customization is really beyond what we can assist with here on the support forums – and with that in mind I’m going to close out this topic. That said, if you hit on any neat solutions to this and want to share them with the community please do so, it would be great to see what you come up with!

    Last but not least, if any other separate problems/questions arise please don’t hesitate to create a new topic and one of the team will be happy to help as best they can.

    Thanks again!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Template issue after updating from 3.6.1 to 3.9.1’ is closed to new replies.