Home › Forums › Calendar Products › Events Calendar PRO › tribe_get_venue not working
- This topic has 11 replies, 3 voices, and was last updated 10 years ago by
Support Droid.
-
AuthorPosts
-
March 28, 2016 at 10:49 am #1094878
juliann tredwell
ParticipantI’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 } ?>March 28, 2016 at 8:44 pm #1095184Cliff
MemberHi. 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!
March 29, 2016 at 4:10 am #1095300juliann tredwell
ParticipantIve 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!
March 29, 2016 at 3:20 pm #1095652Cliff
Membertribe_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.
March 30, 2016 at 5:24 am #1095812juliann tredwell
ParticipantThis reply is private.
March 30, 2016 at 10:41 am #1096030Cliff
MemberMy 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.
March 31, 2016 at 3:29 am #1096276juliann tredwell
ParticipantYou 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
April 1, 2016 at 9:25 pm #1097320Cliff
MemberJuliann, 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.
April 4, 2016 at 7:53 am #1097873juliann tredwell
Participantthat is the full code that i provided
can you show me in my code how to initialized/set $postID variable
April 4, 2016 at 8:45 am #1097921juliann tredwell
Participantfyi i also tried changing <?php echo tribe_get_venue($postID) ?> to <?php echo tribe_get_venue($post) ?> and that didnt work either
April 5, 2016 at 3:52 pm #1098673Cliff
MemberI’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.
April 20, 2016 at 9:35 am #1104918Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘tribe_get_venue not working’ is closed to new replies.
