Testing for single event listing

Home Forums Calendar Products Events Calendar PRO Testing for single event listing

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #15795
    David
    Member

    Hi, I want to test in header.php so see if the page being displayed is a single event listing.
    I tried get post type = tribe events but I do not think it worked. All I need to know is if the page is showing a single event listing. How can I test for this?
    Thanks.

    #15796
    Rob
    Member

    Hey David. I’m not sure I fully understand the issue, but have you checked out if any of our documentation at https://theeventscalendar.com/support/documentation points you in the right direction here? Let me know if not and I can get a dev to take a look.

    #15805
    David
    Member

    Hi Rob,

    The website I am working with (rubycoastmouterehills.co.nz) has 3 sections visit, business and community. Each section has its own 2nd level menu and colour scheme.

    I have listed events from the TEC on 2 wordpress pages by filtering by event category (visit or community). All well so far.

    I need to maintain the 2nd level menu and colour scheme when drilling down to the event detail in the event single.php template. I run a number of tests in header.php to work out which section I am in based on custom post types, categories etc.

    So I am looking to test to see if the user is going to see a single event listing. If they are I will look to see which page referred them to work out if I should show the visit or community submenus. Some events (prob. most) are actually members of both event categories.

    Complicated – yep, sure is …

    Cheers, David

    PS I did try and test on custom post type being tribe_events but I do not think this worked for me. There must be something I can test for early on that will tell me that this is a single event listing.

    #15834
    Rob
    Member

    Hey David. Excellent; thanks for confirming. While I’m not sure about this myself, I’ve asked our dev Jonah to take a look when he hits the forum later this evening. I’ll have him chime in with any thoughts he may have from there.

    #15912
    David
    Member

    Hey Rob, any joy with an answer to this? All I need to do is to test in the header.php file to see if the post showing is a single event listing eg

    http://www.rubycoastmouterehills.co.nz/event/a-touch-of-class/

    Is is something like

    http://wordpress.org/support/topic/how-to-check-for-custom-post-type-and-if-its-hierarchical

    or

    http://wordpress.stackexchange.com/questions/6731/if-is-custom-post-type

    Is is just testing for a custom post type in wordpress?

    Thanks, David

    #15931
    Jonah
    Participant

    Hey David, perhaps this will help:


    if(tribe_is_month()) {
    echo 'Calendar Grid';
    } else if(tribe_is_event() && !tribe_is_day() && !is_single()) {
    echo 'Event List';
    } else if(tribe_is_event() && !tribe_is_day() && is_single()) {
    echo 'Single Event';
    } else if(tribe_is_day()) {
    echo 'Single Day';
    } else {
    the_title();
    }

    #975827
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Testing for single event listing’ is closed to new replies.