Referencing the Events Page in WordPress conditional

Home Forums Calendar Products Events Calendar PRO Referencing the Events Page in WordPress conditional

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #24371
    James
    Participant

    I am building a new site and have created contextual sidebar navigation. I just write little snippets — mostly using the conditional is_page ( ) — to get the navigation to appear on the correct pages.

    For some reason, though, I can’t get the sidebar to display on the events page. Using the slug (‘events’) didn’t work, either.

    #24410
    Barry
    Member

    With reference to the Themer’s Guide would it be workable for you to call a specific sidebar from your custom ecp-page-template.php (and/or ecp-single-template.php) if you wanted a unique sidebar for event related pages?

    A different approach Timothy (Wood – one of the devs) suggested, depending on how much control you need and what the context is, would be to use methods like these:


    if (get_post_type($post->ID) == TribeEvents::POSTTYPE) {
    /* do something... */
    }

    // Or for venue pages, for instance:
    if (tribe_is_venue($post->ID)) {
    /* do something... */
    }

    (Those haven’t been tested by the way, they are just rough sketches of how you might approach this.)

    I hope that helps you out a little, but please don’t hesitate to shout back if you need me to clarify anything 🙂

    #24455
    James
    Participant

    Thanks for the response.

    I am using a plugin called Widget Logic (http://wordpress.org/extend/plugins/widget-logic/). It allows me to have only a single template and just drag a bunch of widgets into the sidebar on the widgets page, then by entering a simple conditional (e.g. “is_page(array(‘slug’,id#))” wherein you can enter EITHER the page’s title from the permalink or its ID number.

    I have a custom navigation set up for the News & Events section of the site (http://staging.m6d.com), but I don’t know what to enter for the events page. When I tried using “events,” it didn’t work. I also tried “events/month” and “month”.

    I am not an advanced user. I am a designer who’s found himself developing sites, and this client really wanted a visual calendar. I like your solution, but it’s important to me that it not feel like they’ve left the News & Events “section” of the site.

    Thanks!

    #24457
    Barry
    Member

    OK – so as before there are a few template tags that could be useful here depending on how much control you need (such as tribe_is_events() and tribe_is_month() – a full list is available in the docs) but if you want a sort of catch-all that works on all Events Calendar pages then I don’t think anything like this is built-in.

    If that is what you want however you could try adding this function to your theme’s functions.php file:

    http://pastebin.com/9gSqT91m

    Then use it within your Widget Logic conditionals:

    is_events_page()

    Does that work for you?

    #24466
    James
    Participant

    I used the pastebin code, and it worked like a charm! (http://staging.m6d.com/events)
    Now it feels like a part of the News & Events section. Thank you!

    #24467
    Barry
    Member

    Excellent, glad that worked for you 🙂

    #24638
    Barry
    Member

    Quick update, a cleaner version of the is_events_page() function can be found here.

    #977689
    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 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Referencing the Events Page in WordPress conditional’ is closed to new replies.