Home › Forums › Calendar Products › Events Calendar PRO › Show events in table
- This topic has 11 replies, 2 voices, and was last updated 13 years, 5 months ago by
Jonah.
-
AuthorPosts
-
November 22, 2012 at 6:08 am #28373
James
ParticipantHello,
I am wanting to show events in a certain category in a simple table list, perhaps within a Page on the site.
e.g. Date | Title | Venue | Time
They can still be part of the overall calendar.
Is there a way of doing this at all?November 23, 2012 at 8:23 am #28397Jonah
ParticipantHi James,
Yes this is possible. You can query events using either our built in tribe_get_events() function (https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events – look at the 3rd example for querying for a specific category) or you can also use WP_Query by querying for ‘tribe_events’ as the post type.
Does that give you what you need?
– Jonah
November 26, 2012 at 8:04 am #28445James
ParticipantHi Jonah,
This looks like just what I’m looking for. However, I’ve not been able to get it working as yet. Where exactly would I need to edit to specify the category?
I’ve created a new page template with the code within, and have tried changing a few things without any luck in getting it displayed on my site.
Many thanks
JamesNovember 26, 2012 at 8:07 am #28447Jonah
ParticipantHi James,
In the tax_query argument, you need to swap out the term ‘conferences’ with the slug of whatever your category is:
'taxonomy' => 'tribe_events_cat',
'field' => 'slug',
'terms' => 'conferences'
Does that help?– Jonah
November 26, 2012 at 8:26 am #28451James
ParticipantThat’s great, thanks!
One last query would be how do I get the venue (and also any custom fields) to display too.
November 26, 2012 at 8:35 am #28453Jonah
ParticipantYou’re welcome James. Are you asking how to filter your query buy venue/custom field or how to display the venue/custom field for each event in the results?
– Jonah
November 26, 2012 at 8:36 am #28454James
ParticipantLiterally just to display the venue. Ideally I want to be able to display in the table…
Date | Title | Venue
…on each row.
November 26, 2012 at 8:48 am #28456Jonah
ParticipantYou should be able to use tribe_get_venue() which will return the name. Here it is in our documentation along with a bunch of other venue related tags you can use: https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-venue-functions/#functiontribe_get_venue
Does that help?
November 27, 2012 at 3:44 am #28528James
ParticipantThanks once again for all your help Jonah.
Unfortunately, I can’t seem to get my venue to display. Also, how do I go about displaying custom fields?
So say I add custom fields called “score” and “competition”, how would I add them in?
I’ve posted my code below, sorry if I’ve done it wrong!
[code]
‘all’,
‘posts_per_page’=>10,
‘tax_query’=> array(
array(
‘taxonomy’ => ‘tribe_events_cat’,
‘field’ => ‘slug’,
‘terms’ => ‘fixtures’
)
)
)
);foreach($all_events as $post) {
setup_postdata($post);
?><a href=""></a>
<a href="">ID, true, ‘j/m/Y’); ?></a>
WANT VENUE HERE
WANT SCORE HERE
WANT COMPETITION HERE[/code]
November 27, 2012 at 6:02 am #28529Jonah
ParticipantHi James,
Please post your code to http://snippi.com/ – it’s much cleaner than posting code here.
Thanks,
JonahNovember 28, 2012 at 3:06 am #28599James
ParticipantApologies Jonah, here it is: http://snippi.com/s/sg5nei7
Thanks again for your time on this.
November 28, 2012 at 4:31 pm #28657Jonah
ParticipantHi James,
Taking your example, I added another table row with the function to return the venue name: http://snippi.com/s/f2kzsd5
Does that help?
– Jonah
-
AuthorPosts
- The topic ‘Show events in table’ is closed to new replies.
