Show events in table

Home Forums Calendar Products Events Calendar PRO Show events in table

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #28373
    James
    Participant

    Hello,
    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?

    #28397
    Jonah
    Participant

    Hi 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

    #28445
    James
    Participant

    Hi 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
    James

    #28447
    Jonah
    Participant

    Hi 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

    #28451
    James
    Participant

    That’s great, thanks!

    One last query would be how do I get the venue (and also any custom fields) to display too.

    #28453
    Jonah
    Participant

    You’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

    #28454
    James
    Participant

    Literally just to display the venue. Ideally I want to be able to display in the table…

    Date | Title | Venue

    …on each row.

    #28456
    Jonah
    Participant

    You 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?

    #28528
    James
    Participant

    Thanks 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);
    ?>

    &lt;a href=&quot;"&gt;</a>
    &lt;a href=&quot;"&gt;ID, true, ‘j/m/Y’); ?&gt;</a>
    WANT VENUE HERE
    WANT SCORE HERE
    WANT COMPETITION HERE

    [/code]

    #28529
    Jonah
    Participant

    Hi James,

    Please post your code to http://snippi.com/ – it’s much cleaner than posting code here.

    Thanks,
    Jonah

    #28599
    James
    Participant

    Apologies Jonah, here it is: http://snippi.com/s/sg5nei7

    Thanks again for your time on this.

    #28657
    Jonah
    Participant

    Hi 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

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Show events in table’ is closed to new replies.