[Resolved] Sidebar/no sidebar and custom header for Events Calendar pages

Home Forums Support [Resolved] Sidebar/no sidebar and custom header for Events Calendar pages

Home Forums Support Sidebar/no sidebar and custom header for Events Calendar pages

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #647373
    Heidi

    Please help, as I am going crazy trying to figure out how to achieve the following with my Events Calendar pages:

      Display a custom header on all Events-related pages.
      Display a sidebar on single event pages only (NOT on the Events calendar/archive/index page).

    I have read several threads on this site, including https://generatepress.com/forums/topic/tribe-events-calendar-without-sidebar/, https://generatepress.com/forums/topic/issues-with-the-events-calendar/#post-176870, https://generatepress.com/forums/topic/the-events-calendar-and-generatepress-premium-header/, and a couple more.

    Here’s what I’ve tried, and the results I got:

      Selected Events > Settings > Display > Default Events Template. My custom header displays and there’s no sidebar on the Events calendar/archive/index page (good), but there are no sidebars on the single event pages (bad).
      Switched to the Default Page Template. Sidebars show up on single event pages (good), but also on the Events archive/index page (bad). Custom header also disappears (bad).
      Fiddled with Appearance > Customize > Layout > Sidebars. No combination gives me the look I want. I was hoping there would be a layout option for The Events Calendar, but I only saw options for changing colors.
      Set the Page Header > Global Locations for my desired header to appear on all Events-related single post types, archive post types, and taxonomies archives in an attempt to get the header to show up when I use Default Page Template. No luck. Only when I add it to ALL pages does it appear with this page template, but only on the single event pages and every page of the site EXCEPT the Events calendar/archive/index page.
      Added the php snippet from one of the aforementioned posts to my Code Snippets. Made sure to substitute “right-sidebar” for “no-sidebar.” Also tried “right-events-sidebar” to match with a custom sidebar I created. No effect in either case.
      Tried a different php snippet from another user. Removed all content EXCEPT the sidebar. (I’m sure I was missing something important).
      Deactivated the Custom Sidebars plugin I’m using, in case there was a conflict. No effect.
      I have added some custom CSS to style other parts of the calendar, but I haven’t found any directions on using CSS to achieve what I outlined above. Is it possible?

    Am I missing something super obvious? That would be awesome, even if I have spent the better part of an afternoon trying to figure this out. Appreciate any guidance. Thanks! P.S. The URL I submitted is to the Events calendar page of the site I’m working on.

    #647474
    Tom
    Lead Developer
    Lead Developer

    Hey Heidi,

    Have you checked out GPP 1.7 yet? It’s currently in public testing and will be released officially tomorrow: https://generatepress.com/gp-premium-1-7/

    I have a feeling it should make all of the above possible (which is exciting!).

    Custom Headers: https://docs.generatepress.com/article/header-element-overview/
    Custom Layouts: https://docs.generatepress.com/article/layout-element-overview/

    I believe the Display Rules will give you the necessary options to target the pages you’re wanting to target.

    Let me know 🙂

    #647507
    Heidi

    Hi Tom,

    Thanks for responding! Hadn’t checked out GPP 1.7 so fired it up. Was so excited and hopeful, as the Elements are an *awesome* new feature that, in theory, should have made this a snap. I set up my new header and page layouts, and assigned them accordingly (so easy!)

    Good news is I can now get the custom header to show regardless of whether I select “Default Events Template” or “Default Page Template” in The Events Calendar Settings. Yay!

    Bad news is I can’t get the sidebar layout to work properly. If I choose “Default Events Template,” I can’t get the sidebar to show up anywhere for events, no matter how I set the Element to display. Conversely, if I choose “Default Page Template,” I can’t get the sidebar to NOT display on the Events Calendar index page. Maybe I’m not selecting the right exclusion? Since the Events Calendar page isn’t really a “page”, I’m not sure what I should choose. I tried all the archives pages and even excluding “entire site,” and nothing worked.

    Any other suggestions? Really appreciate the support!

    #647516
    Heidi

    A quick add: I found this article on Modern Tribe’s site (https://theeventscalendar.com/knowledgebase/tec-with-jetpack/), which covers how their calendar pages are defined by Jetpack. Setting aside the references to Jetpack, I found this bit that explains what kind of page/post the Events Calendar is:

    “To clarify things a bit, the main events calendar and all categories are archives rather than pages. It might sound, then, like we would be able to use the filter that hides the widget from Archives instead. Not a bad guess, but unfortunately this does not work. For some reason or another, Widget Visibility neither recognizes the main calendar nor event categories as a type of Archive.”

    I’ve also seen it referred to as “a WordPress ‘custom post type archive’ page, not an actual WordPress ‘page’ or ‘post’.” Which, of course, makes it difficult to style!

    #648031
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    So there’s no archive types that related to Events in the Display Rules? It should be something like “Events Archive”.

    #648081
    Heidi

    Yes, there are. But selecting “Event Archive” or even “All Archives” to be excluded has no effect on how my sidebar layout element functions.

    I set up a “Single Events Page” layout element, with content-sidebar, to display on “All Events” posts, and be excluded on “Event Archive.”

    If I select “Default Events Template” in The Events Calendar (TEC) settings, the Single Events Page layout does not display despite my settings above. No sidebars on EITHER the index/archive calendar page, or individual events.

    If I select the “Default Page Template” in TEC settings, the Single Events Page layout shows up for BOTH the single event and the calendar “index” page. Cannot suppress it for the index page, despite my settings above.

    Whatever code Modern Tribe uses to pull from these page templates appears to supersede any additional code that gets set with Elements. Not sure if it has something to do with the fact that their calendar index page is “sort of” like an archive page, but not really. Which is why Jetpack has problems with TEC, too.

    #648573
    Tom
    Lead Developer
    Lead Developer

    Any chance you can set it up so the layout applies to both pages, and then link me to both of the pages?

    #648581
    Heidi

    Sure thing. Single Events Page layout element (with content-sidebar) is now set up to display on all Events pages and Event Archive page. TEC set to Default Events Page.

    Link to single event page > https://staging2.nusciencesolutions.com/event/that-food-does-what-sep-6/

    Link to event calendar/index/archive page > https://staging2.nusciencesolutions.com/events/

    I appreciate your looking into this!

    #648588
    Tom
    Lead Developer
    Lead Developer

    And you currently have “Default Page Template” selected in the TEC settings?

    #648607
    Heidi

    No, I had the TEC Default Events Page Template selected. I’ll switch it over to Default Page Template now.

    #648610
    Heidi

    OK, now set to Default Page Template.

    #648628
    Tom
    Lead Developer
    Lead Developer

    Ok, so now the pages look better, but they’re ignoring the custom layout you set, correct?

    Do those pages have static pages in the Dashboard, or are they generated by TEC?

    We may need to use a filter if TEC doesn’t want to play nice with WP conditionals:

    https://generatepress.com/forums/topic/issues-with-the-events-calendar/#post-176870
    https://docs.generatepress.com/article/sidebar-layout/

    #648685
    Heidi

    Correct. I like (and want) the sidebar on the single event page. I don’t like (and don’t want) the sidebar on the calendar page – I want it to be centered like the Default Events Template version. TEC ignores my custom element layout no matter which page layout I choose.

    No static pages. TEC generates calendar as a ‘custom post type archive’ and single events as ‘custom post.’

    I’ve tried the filter in your link. Doesn’t work for me. Is there another filter I can try?

    #649417
    Tom
    Lead Developer
    Lead Developer

    That’s so strange.. This should work:

    add_action( 'wp', function() {
        add_filter( 'generate_sidebar_layout', 'tu_custom_events_sidebar_layout' );
    } );
    
    function tu_custom_events_sidebar_layout( $layout ) {
     	// If we are on a tribe events page, set the sidebar
     	if ( is_post_type_archive( 'tribe_events' ) ) {
     	 	return 'no-sidebar';
            }
    
     	// Or else, set the regular layout
     	return $layout;
     }
    #650782
    Heidi

    Hey Tom,

    Thanks for sticking with me. The filter didn’t work, so I decided to go back and retry the sidebar and element toggles, one at a time, with the hope that I missed the necessary combination in earlier attempts, or there was an unexplained mystery that resolved itself while I was banging my head against the wall.

    The great news is I FINALLY got it to work using just the Customizer and Element tools, as originally hoped and expected, so that is AWESOME. I have no idea why it didn’t work earlier in the week, as I had tried the very same combos with no luck. But I’ll accept it with grace and humility. 🙂

    Here is the combination that ultimately worked, for the benefit of anyone else who might need it:

    1. Appearance > Customize > Layout > Sidebars
    – Sidebar Layout > Content (no sidebars)
    – Blog Sidebar Layout > Content (no sidebars)
    – Single Post Sidebar Layout > Content/Sidebar

    2. Element > New Layout > Single Event Page
    – Sidebar > Content/Sidebar
    – Container > Default
    – Display Rules > Location > Event > All Events

    Ultimately I did not need to exclude the TEC archive/calendar page for the element. The sidebar just stopped showing up when I hit the right combo.

    Thanks again for your incredible and patient support. It’s the best in the biz!

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.