tribe_get_events works on most pages, but not on WP category archives

Home Forums Calendar Products Events Calendar PRO tribe_get_events works on most pages, but not on WP category archives

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1273116
    Logan
    Participant

    I have used the following code to pull in the 5 most recent events on a pop-out menu. It works fine on most pages, printing out 5 upcoming events with date and country. But, on categories archives for other WordPress categories, it renders nothing. Please help.

    'start_date' => date('Y-m-d H:i:s'),
    ) );
    foreach ( $events as $event ) {
    $sdate = tribe_get_start_date($event,false,'M j');
    $elink = tribe_get_event_link( $event );
    $ecntry = tribe_get_country( $event );
    echo "

    $sdate $event->post_title $ecntry
    “;
    }?>

    #1274046
    Trisha
    Member

    Hello, Logan!

    It looks like the editor garbled your code a bit but I think I got the ‘gist’ of it 😉

    First off, I do want to note that we are fairly limited in how much we can support custom development questions like this. You can see more about the support options  available here: https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    To test, I put the code inside a function and added it to the theme’s functions.php file. I then added tribe_custom_loop() to the archive.php file, both inside and outside the loop. I was able to see output in both cases.

    Here is a gist of the function I created:

    https://gist.github.com/trishasalas/50b5225ecf5d40db0e5bc8775fc71fdf

    I’m not sure how you were implementing it but my suggestion is to try this (if different than yours) and if this doesn’t work I suspect it may have to do with your theme configuration.

    If you’re curious you could go through the ‘Testing for Conflicts’ guide here: https://theeventscalendar.com/knowledgebase/testing-for-conflicts/

    I hope this help, let me know how it goes!

    Cheers,
    Trisha

    #1284955
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘tribe_get_events works on most pages, but not on WP category archives’ is closed to new replies.