[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 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #650901
    Tom
    Lead Developer
    Lead Developer

    That’s great! Thanks so much for sharing the solution ๐Ÿ™‚

    #839943
    Pat

    This is an FYI for anyone who might encounter this (above) or similar problem. The above information was very helpful, but didn’t work in my case. Event Tickets (v 4.9) that works with The Events Calendar plugin now has a separate page for collecting event attendee information – and it includes an unwanted sidebar where the forms are duplicated. As in the case above, this generated TEC page is an ‘archive page’.

    The only way I was able to disable sidebars on this generated page using a Layout Element was to disable ALL archives. I can’t do that however because the blog archive requires a sidebar. Tom’s helpful functions.php code snippet (above) also did not work. The only way I got this to work was using this modified code snippet…which seems counterintuitive (to me) but it works:

    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 the Event Attendee Form page, set the sidebar
    if ( 'page' == get_post_type() && is_archive() ) {
     	 	return 'no-sidebar';
            }
    
     	// Or else, set the regular layout
     	return $layout;
    }

    Hopefully this will help others who run into this problem! And if anyone can refine this, please share your results.

    #840027
    Tom
    Lead Developer
    Lead Developer

    Thanks for sharing your solution! ๐Ÿ™‚

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