custom term not showing in javascript template

Home Forums Calendar Products Events Calendar PRO custom term not showing in javascript template

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #580590
    baynature
    Participant

    I have a custom termonoloy, locations, that I want to add to the tooltip in the Month view.
    I’m using this code to get the data and add it to single.event.php:
    $additional_data = array();
    $terms = get_the_terms( $post->ID, ‘geographies’);
    if ( $terms && ! is_wp_error( $terms ) ) :
    $location_links = array();
    foreach ( $terms as $term ) {
    $location_links[] = $term->name;
    }
    $locations = join( “, “, $location_links );
    endif;
    $additional_data[‘locations’] = $locations;

    I’ve added this to tooltip.php:
    [[=locations]]

    And I get this error:
    uncaught exception: TemplateError: ReferenceError: locations is not defined (on tribe_tmpl_tooltip line 18)
    What am I missing? I’m testing this out in my local environment.
    Thanks!

    #588116
    Barry
    Member

    Hi – sorry to hear you’re hitting difficulties.

    Just to confirm, did you also pass your additional data into the template data function? For instance, within the data-tribejson attribute you would need:

    echo tribe_events_template_data( $post, $additional_data )

     

    #588497
    baynature
    Participant

    D’oh! I had commented that out. It’s working now. Thanks, Barry!

    #589455
    Barry
    Member

    <p>Awesome, glad you’re all sorted :-)</p><p>I’ll go ahead and close out this thread – but if we can help with anything else please don’t hesitate to open new threads as needed and one of the team will be only too happy to help.</p><p>Also, if you have a moment to spare, we’d love to hear from you and get your thoughts on The Events Calendar over on our plugin review page. Thanks again!</p>

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘custom term not showing in javascript template’ is closed to new replies.