How to check if I’m on a "virtual page"
I understand that for Community Events the pages like /events/your-events/add are “virtual” meaning they are not real pages with meta data and such. However, in my custom theme, the layout and content of the sidebar of a page is determined by the slug of that page. For instance, another page on my site called “Articles” with a slug of “articles” which automatically loads a sidebar file called “sidebar-articles.php” based on the page’s slug.
So, since the virtual pages don’t have slugs, is there another way to determine whether the user is visiting a virtual page as opposed to a real page? Like a function or something?
Thanks for getting in touch! The Community Events add-on has two ‘virtual pages’ that you can check for by using the following template tags:
- tribe_is_community_edit_event_page() – Returns true if displaying the ‘Edit’ or ‘Submit’ Event form
- tribe_is_community_my_events_page() – Returns true is displaying the ‘My Events’ list page
For further information on the template tags available with the Community add-on, take a look at the Community Documentation. Let me know if that gets you pointed in the right direction, or if you have further questions. Thanks! 🙂