Home › Forums › Calendar Products › Events Calendar PRO › how to pull in venue and organiser details on single event page
- This topic has 11 replies, 3 voices, and was last updated 10 years, 4 months ago by
Geoff.
-
AuthorPosts
-
November 17, 2015 at 9:05 am #1027070
tony
ParticipantAt the moment the venue and organiser details are pulled in via a link on the single events page in the box at the bottom of the page. This then requires the user to click on the link and go to another page to view the information.
I have created a custom single event template and want it to automatically pull all of the information about the venue and the organiser into the main content section, rather than just pulling in the link to these pages in the summary box at the end of the single event page.Can you give me a heads up on whether this is possible and how I might achieve it?
Many thanks! SusanNovember 17, 2015 at 12:23 pm #1027133Geoff
MemberHey Susan and welcome to the forums!
I’m stoked to hear you made a custom event template–nice work. 🙂
The venue and organizer details are available in a handful of functions you can use to echo the data in the template. There are quite a few for each, so here are some results from our documentation to get you started:
Let me know if you need help looking for a specific function and I’d be happy to help as best I can!
Cheers,
GeoffNovember 18, 2015 at 7:14 am #1027561tony
ParticipantThanks for this Geoff. I’d be really grateful for a bit more help if that’s OK – afraid I’m only a beginner with php. So, specifically what I am looking to pull into the single page content is the featured image and content about the venue – rather than the information input into the information fields. Similarly with the organiser.
Have looked at some of the template tags from your documentation – thanks for pointing these up. So I tried tribe_get_venue_details but not sure how to call this in the single event template. Tried <?php tribe_get_venue_details(); ?> but nothing happened so am guessing this is incorrect? Could you point me in the right direction with this – thanks so much. Susan
November 18, 2015 at 7:26 am #1027572Geoff
MemberHi Susan and thanks for following up!
Ah yeah, you can echo the functions in the template to return those values. So, for example:
<?php echo tribe_get_organizer_website(); ?>…and that would return the organizer’s website URL.
Let me know if that helps do the trick. 🙂
Geoff
November 18, 2015 at 7:45 am #1027581tony
ParticipantAh yes! Using echo pulled something into the page. So the code you provided pulled in a url (unlinked) to the organiser page on the website. What I would like to do is to pull in the actual content of that page – including the featured image. And likewise for the venue.
In terms of venue content, I tried <?php echo tribe_get_venue_details(); ?> but nothing showed up except the word “array”. Apologies if these are really basic questions.
Susan
November 18, 2015 at 11:51 am #1027662Geoff
MemberNo worries, Susan! I’m totally happy to help as best I can. 🙂
You probably need to grab the venues for the event and then call the details from there. For example:
https://gist.github.com/geoffgraham/fc34482b5584f6da3972
Let me know if that example helps!
Geoff
November 18, 2015 at 11:09 pm #1027839tony
ParticipantHi again Geoff, thanks for your continued assistance.
So yes, that code pulls in some of the meta details. But what I am after is the actual post content. So the equivalent of <?php the_content(); ?> for venue and organizer pages. I have had a look at venue.php and couldn’t see anything in that template file that seemed to pull in the content that I could grab and paste into my custom single-event.php. Likewise with organiser.php. Any ideas? Thanks! Susan
November 19, 2015 at 6:42 am #1028109Geoff
MemberOh gotcha! Sorry, I must have misunderstood–thanks for clarifying.
Venues and Organizers actually use the_content() just like any other WordPress post. So, if you want to grab the content for a particular venue, you can call for the content in the same loop where the Venue/Organizer is being queried.
A good example is looking at the single-organizer.php and single-venue.php templates. Those can both be found in the Events Calendar PRO plugin files under /src/pro/views. Open those up and you will see how the venue is both queried and where the_content() is called to display the post content.
Does this help a little more? Please let me know!
Geoff
November 21, 2015 at 8:29 am #1029046tony
Participantthanks for your continued help with this Geoff. So I found the relevant template files but afraid I’m having some difficulty identifying the right bit of code to call in my single-event.php file. I tried Inserting this bit of code, but it simply called the content of the single event, not the venue.
<!– Venue Description –>
<?php if ( get_the_content() ) : ?>
<div class=”tribe-venue-description tribe-events-content entry-content”>
<?php the_content(); ?>
</div>
<?php endif; ?>
I’m probably missing something really obvious, sorry, but would appreciate a bit more help. Many thanks! SusanNovember 24, 2015 at 5:11 pm #1030445Barry
MemberHi Susan,
I wanted to drop by since Geoff is largely out this week and you’ve been waiting a few days already 🙂
The problem with using either get_the_content() or the_content() in this situation is that both assume you are interested in the current post. In the context of a single event view, that means the event itself, not the venue or organizer.
However, you can certainly obtain and display them by doing something like this:
echo apply_filters( 'the_content', get_post_field( 'post_content', tribe_get_organizer_id() ) );That arguably isn’t the preferred way – but it will probably do the trick for you in this specific case. Note you can swap out tribe_get_organizer_id() with tribe_get_venue_id() to get the venue description.
Last but not least, though we’re more than happy to steer you in the right direction if we can, I do want to highlight that there is a limit to the amount of customization support we can offer. It is also important you understand changes like these sufficiently well to be able to maintain them yourself in future.
With that in mind, it might be that you prefer to work with an independent developer/designer if you think you’re going to need further assistance with these items – check out this useful list of folks who might be able to help further if so 🙂
Does that help?
December 2, 2015 at 9:12 am #1033912tony
ParticipantThanks for all your help with this Barry and Geoff. Really appreciate it! Hope you guys had a great thanksgiving celebration. Susan
December 2, 2015 at 12:56 pm #1034100Geoff
MemberRight on and thanks for following up, Susan! Hope you had a great Thanksgiving as well and thanks again for getting in touch. 🙂
Cheers,
Geoff -
AuthorPosts
- The topic ‘how to pull in venue and organiser details on single event page’ is closed to new replies.
