Help Desk

How to check if I’m on a "virtual page"

  • Topics: 1
    | Permalink

    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?

    Posts: 3519 Answers: 115
    | Permalink

    arcanepsyche,
    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! 🙂

    -Casey-

    Posts: 3519 Answers: 115
    | Permalink

    I just wanted to follow up and see if you’re all set here or if you still have further questions. Just let me know if you have further questions or if I should go ahead and close out this thread. Thanks! 🙂

    -Casey-

    Posts: 3519 Answers: 115
    | Permalink

    Since I haven’t heard back from you here, I’m going to go ahead and close out this thread. Feel free to start a new thread if you have further issues. Thanks! 🙂

    -Casey-