is_main_event_page

Home Forums Calendar Products Events Calendar PRO is_main_event_page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #206339
    Lee
    Participant

    Is there a function that will return true if a user is on the main event page? (i.e. site.com/events)

    I was using the get_the_terms() function to retrieve the categories. Thanks

    #206548
    Casey
    Participant

    leepettijohn,
    Thanks for getting in touch! The tribe_is_in_main_loop() function should do exactly what you’re wanting to do here. Give that a shot and let me know if you have further questions. Thanks! 🙂

    -Casey-

    #207902
    Lee
    Participant

    Where should this go? I have put it in a couple different places in the php code and every page I pull up (main, category, etc.) all respond that it is not in the main loop.

    http://ffdev1.net/events/

    Here is the code I’m using
    if (tribe_is_in_main_loop()){
    echo ‘is in main loop’;
    }
    if (!tribe_is_in_main_loop()){
    echo ‘is not in main loop’;
    }

    #208862
    Casey
    Participant

    Lee,
    I’m so sorry, but this is my fault for not completely understanding your question. Your best bet would be to use something like tribe_is_view() and check for the particular view that you want to execute your code on. Something like this:


    if ( tribe_is_view( 'upcoming' ) ){
    echo 'is showing upcoming events';
    } else {
    echo 'is not showing upcoming events';
    }

    You should be able to use the following params with this function: month, day, week, single-event, upcoming, photo, and map.

    Give that a try and also take a look at our documentation to see all of the ‘tribe_is_’ conditional functions that exist. Thanks! 🙂

    -Casey-

    #209367
    Lee
    Participant

    Took me a while but I used tribe_event_in_category()

    I put this function in the list/single_event.php and asked if it was a certain category. Then I passed those variables to the list/loop.php and if the categories were different then I knew I was on the main event page.

    Not a great solution but it works. =)

    Like I said before, let me know if you incorporate a function that checks to see if the user is on the main page (site.com/events)

    Cheers.

    #211348
    Casey
    Participant

    Lee,
    Glad you were able to find a workaround. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out, but feel free to start a new thread if you have further questions. Thanks! 🙂

    -Casey-

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