tribe_get_venue not working

Home Forums Calendar Products Events Calendar PRO tribe_get_venue not working

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1094878
    juliann tredwell
    Participant

    I’m trying to make a list of the latest upcoming events, Ive got everything working EXCEPT pulling the event venue name you can see this in the “Upcoming Events” section here http://spia.staging.wpengine.com/ and the following is my code…

    <?php
    $posts = get_posts(array(
    ‘post_type’ => ‘tribe_events’,
    ‘order’ => ‘ASC’,
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘_EventStartDate’,
    ‘posts_per_page’ => 3,
    ‘post__in’ => $post_ids,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => date(“Y-m-d H:i”),
    ‘compare’ => ‘>=’,
    ‘type’ => ‘DATE’
    )
    )
    ));
    if( $posts ) { ?>
    <div id=”events”>
    <?php foreach( $posts as $post): ?>
    <?php setup_postdata($post); ?>
    <div class=”event”>
    <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
    <div class=”table”>
    <div class=”table-cell”>
    <div class=”event-date-box”>
    <span class=”month”><?php echo tribe_get_start_date($postID, true, ‘M’); ?></span>
    <span class=”day”><?php echo tribe_get_start_date($postID, true, ‘j’); ?></span>
    </div>
    </div>
    <div class=”table-cell”>
    <div class=”entry”>

    ” title=”<?php the_title(); ?>”><?php the_title(); ?>

    <?php if(get_field(‘sponsor’)) : ?><p class=”sponsor”>SPONSOR: <?php the_field(‘sponsor’); ?></p><?php else: ?><?php endif; ?>
    <div class=”event-time”><?php echo tribe_get_start_date($post, false, $format = ‘g:i A’ ) . ‘ – ‘ . tribe_get_end_date($post, false, $format = ‘g:i A’); ?></div>
    <?php echo tribe_get_venue($postID, true) ?>
    </div>
    </div>
    </div>
    </div>
    </div>
    <?php endforeach; ?>
    </div>
    <?php } ?>

    #1095184
    Cliff
    Member

    Hi. Cool customization.

    It looks to me like you’re using tribe_get_venue() incorrectly.

    You have “$postID, true” but the “, true” part shouldn’t be there.

    You might be able to use either tribe_get_venue( $postID ) or even just tribe_get_venue().

    Also, it’s a good idea to make sure all your Modern Tribe plugins (and WordPress core) are at their latest versions.

    Please let me know how things go for you.

    Thanks!

    #1095300
    juliann tredwell
    Participant

    Ive tried both <?php echo tribe_get_venue() ?> & <?php echo tribe_get_venue($postID) ?> and made sure my wordpress and Events Calendar plugin was the most recent and they are but its still not working…

    maybe you have some other code that will show the 3 most recent events by date?

    or I can give you access to this WordPress login so you can look at my files ect, lmk thanks!

    #1095652
    Cliff
    Member

    tribe_get_venue() returns an integer — the post ID of the Venue post type, tribe_venue — so it could be echoing ‘321’ and you’re not noticing it on the page.

    You could look to some of our widgets or templates (able to be overridden via the Themer’s Guide) to get some code.

    I hope this helps you.

    #1095812
    juliann tredwell
    Participant

    This reply is private.

    #1096030
    Cliff
    Member

    My apologies! I gave you wrong information. Please forgive me.

    tribe_get_venue() takes a Venue ID and returns a string (the name of the Venue), which is what you want.

    tribe_get_venue_id() returns the Venue ID.

    So your use of tribe_get_venue( $postID ) is correct as long as $postID is the ID of the Event or the Venue.

    Is your $postID being set correctly?

    ===

    FYI: My mentioning the widgets was for you to reference the code used, not for you to abandon your custom code and use a pre-built widget instead.

    #1096276
    juliann tredwell
    Participant

    You tell me if my “$postID being set correctly?” I provided all my code above and a login so that you can see my setup and theme files please do so and get back to me with a working solution

    #1097320
    Cliff
    Member

    Juliann, I apologize but we’re not allowed to login to customer sites, and we do not provide customization-specific support per our Scope of Support / Terms.

    In the code snippet you originally provided, I see $postID variable in use but never initialized/set.

    I assume you did not provide me the full code — or that I’m not understanding the context of this snippet/file. For example, is it in your child theme’s tribe-events theme override folder? If yes, what is its filename? If no, where is this file located and how/when is it loaded?

    When you’re developing customizations, it’s best to enable WP_DEBUG and PHP error reporting. Having these active might help you determine the cause of the issue.

    #1097873
    juliann tredwell
    Participant

    that is the full code that i provided

    can you show me in my code how to initialized/set $postID variable

    #1097921
    juliann tredwell
    Participant

    fyi i also tried changing <?php echo tribe_get_venue($postID) ?> to <?php echo tribe_get_venue($post) ?> and that didnt work either

    #1098673
    Cliff
    Member

    I’m sorry but since I have not been provided enough information to continue moving this forward, and since this is in the customization-realm that we really don’t support, I’ll need to refer you to your developer or reference our list of known customizers to receive further customization support.

    #1104918
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘tribe_get_venue not working’ is closed to new replies.