Home › Forums › Calendar Products › Events Calendar PRO › Referencing the Events Page in WordPress conditional
- This topic has 7 replies, 3 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
August 30, 2012 at 2:42 pm #24371JamesParticipant
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.
August 31, 2012 at 9:49 am #24410BarryMemberWith 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 🙂
September 1, 2012 at 5:47 pm #24455JamesParticipantThanks 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!
September 2, 2012 at 7:21 am #24457BarryMemberOK – 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:
Then use it within your Widget Logic conditionals:
is_events_page()
Does that work for you?
September 2, 2012 at 3:16 pm #24466JamesParticipantI 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!September 2, 2012 at 4:18 pm #24467BarryMemberExcellent, glad that worked for you 🙂
September 6, 2012 at 8:32 am #24638BarryMemberQuick update, a cleaner version of the is_events_page() function can be found here.
July 7, 2015 at 6:26 am #977689Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Referencing the Events Page in WordPress conditional’ is closed to new replies.