Month and Venue in the Title of individual event

Home Forums Calendar Products Events Calendar PRO Month and Venue in the Title of individual event

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #252036
    Nick Ritar
    Participant

    Hi,

    I’m trying to add the Month, Year and Venue (or Tag) to the <title> tag for individual events on my site.

    This is because we run events with the same event title over and over again at many locations / venues and I’d like to have more information on search results and FB shares etc than just the event title.

    I’ve installed the Yoast plugin and tried to use the variables mentioned in https://theeventscalendar.com/support/forums/topic/include-event-date-in-event-page-title/ without much luck.

    I’ve also mucked around with filteres in function.php… but also have not really gotten anywhere.

    Any tips on how i might achieve this.

    Cheers
    Nick

    #253253
    Casey
    Participant

    Nick,
    Thanks for getting in touch! Take a look at this snippet, which has many different scenarios for changing the page title. That, along with our docs should at least get you started in the right direction.

    Just let me know if you have further questions. Thanks! 🙂

    -Casey-

    #253528
    Nick Ritar
    Participant

    Hi Casey,

    That’s great. Thanks.

    Can you please give me a pointer on where I can find out how to use variables (such as EventStartDate or Tags) in the above snippet. Or perhaps a short example.

    Thanks for your help 🙂

    #253547
    Casey
    Participant

    Nick,
    Take a look at the following functions in our documentation, as I think they’ll do what you need:

    Hopefully that gets you pointed in the right direction. Thanks! 🙂

    -Casey-

    #253829
    Nick Ritar
    Participant

    Hi Casey,
    Getting close,

    It’s working for the tribe_is_photo pages really well, but not for tribe_is_event…… if i just use is_single it works, but of course on blog pages as well

    // Tribe events: Manually set title for each event listing type
    function filter_events_title ($title) {
    if ( tribe_is_event() && is_single() ) { // single event
    $title = ‘Nicks attempt to get this working | ‘;
    }
    elseif ( tribe_is_photo() && !is_tax() ) { // Photo View Page
    $title = ‘Upcoming Courses | ‘;
    }
    elseif ( tribe_is_photo() && is_tax() ) { // Photo View Category Page
    $title = tribe_meta_event_category_name() .’ Courses | ‘;
    }
    return $title;

    }

    can you spot whats wrong?

    #253890
    Nick Ritar
    Participant

    No matter what page i am on tribe_is_event() does not return 1

    #254005
    Nick Ritar
    Participant

    I ended up giving up on tribe_is_event() and ended up using !comments_open and is_single to work out if it is an single event.

    All this is being called through functions.php (just to be clear).

    I’m having trouble getting many of the tribe functions to give me the expected result, for example tribe_get_venue() and tribe_get_venue_link() do not return anything via functions.php, but do within tribe-events/single-event.php

    tribe_get_start_date does work however

    if( is_single() && !comments_open() ) { // Single Events
    $title = $title.tribe_get_start_date( $post->ID, false, ‘F Y ‘ ).’ | ‘;
    }

    #254515
    Nick Ritar
    Participant

    whooops scratch that… tribe_get_start_date( $post->ID, false, ‘F Y ‘ ) returns today’s date… nothing to do with the event.

    I’ve tried your snippet in functions.php with the 2013 theme…… and it behaved the same. That is to say that it worked fro a Photo View page, but not an individual event page.

    So it’s not anything in our theme.

    #255051
    Casey
    Participant

    Nick,
    Take a look at the is_single() documentation. You can do a specific check for a post type like this:


    is_single( 'tribe_events' )

    It’s also possible that you need to add a ‘global $post’ declaration to the top of your function, in order for the $post variable to have data in it.

    Hopefully those suggestions get you on the right track. Good luck and thanks! 🙂

    -Casey-

    #256380
    Nick Ritar
    Participant

    Thanks for the tip about is_single(). I’ll check that out.

    At the moment that is not my problem though.

    I can’t get tribe_get_start_date( $post->ID, false, ‘F Y ‘ ) to return anything useful. It just gives me todayts month, not the month of the event.

    Can you please take a look at my code below and see what i’m doing wrong.

    Cheers
    Nick

    http://snipt.org/Wijih3

    #261948
    Casey
    Participant

    Nick,
    Try doing something like this instead: https://gist.github.com/ckpicker/d6cf7cbd1d2d6ea70aef

    That seemed to do the trick for me locally. Good luck! 🙂

    -Casey-

    #262928
    Nick Ritar
    Participant

    Niether tribe_is_event( $post ) or is_single( ‘tribe_events’ ) resolves to true, when I am viewing a single event on a page like http://staging01.laocoffee.com.au/course/gourmet-mushroom-cultivation-sept-2014-sydney/

    I can get ( is_single() && !comments_open() ) to resolve true for this page, but obviously this is a hack.

    Even when I do get ( is_single() && !comments_open() ) to resolve true, $title.tribe_get_start_date( $post->ID, false, ‘F Y ‘ ) resolves to todays Month and Year, not the events date a year.

    Thanks for your help so far, but can you think of any reason why the tribe variables are not returning anything useful.

    Cheers
    Nick

    #263134
    Casey
    Participant

    Nick,
    Have you tried testing for conflicts, while your function is active? It’s possible that a plugin, or your theme is hijacking the $post variable in the ‘wp_title’ filter.

    I was able to successfully test my code and saw the TITLE tag changed.

    Hopefully that helps to point you in the right direction. Good luck and thanks! 🙂

    -Casey-

    #350377
    Nick Ritar
    Participant

    I still can’t get it to work… even with the twenty thirteen theme…. nothing else activated and a clean cache.

    I’ve had a few people working on this project… looks like we might have to reinstall the plugins…as i think someone may have broken something in your code.

    Would you mind leaving this open while i test .

    Cheers
    Nick

    #350581
    Casey
    Participant

    Nick,
    That’s fine, just let me know if you’re able to sort this out. Thanks! 🙂

    -Casey-

Viewing 15 posts - 1 through 15 (of 17 total)
  • The topic ‘Month and Venue in the Title of individual event’ is closed to new replies.