Show number of current events

Home Forums Calendar Products Events Calendar PRO Show number of current events

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #997069
    Christoph
    Participant

    How can I show the total number of current events on my website?

    #997247
    Nico
    Member

    Hi Christoph,

    Thanks for reaching out to us! Hoperfully there’s a simple way of achieving what you ask for ๐Ÿ™‚

    You can use the wp_count_posts WordPress function. I’ll show you how to do so:


    $published_events = wp_count_posts('tribe_events')->publish;
    // use var_dump ( wp_count_posts('tribe_events') ); to see all info returned by wp_count_posts

    Please let me know if this is what you are looking for and if you have any follow-up questions about this,
    Best,
    Nico

    #997252
    Christoph
    Participant

    Thank you, but this show the total number of all events include the expired events.
    I want to show the total number of only events in the future.
    I hope you understand what I mean.

    #997623
    Nico
    Member

    Hey Christoph,

    Thanks for clarifying that out!

    This snippet Brian -another support team member- crafted should do the trick:

    https://gist.github.com/jesseeproductions/ebc7fbaa44f2ce336dbe

    Please give that a try and let me know,
    Best,
    Nico

    #997684
    Christoph
    Participant

    Thank you. This show me the right way, but it need a small change:

    The line “echo $event_count->post_count;”
    must changed to “echo $event_count->found_posts;”

    then the script do what I want.

    #997760
    Nico
    Member

    Hey Christoph,

    I’m glad to hear you could work it out from there ๐Ÿ™‚

    Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Show number of current events’ is closed to new replies.