Site logo

Archived topic

Tribe Events Calendar without Sidebar

11 replies · Started by Louis on August 11, 2016

Viewing posts 1–12 of 12

Hi Tom,

I happen to see that post https://generatepress.com/forums/topic/sidebar-on-events-calendar-pages-esp-single-event-view/
and I always wanted to display Tribe Events Calendar with no-sidebar (but this is not a page I can mofify). So I try the code you propose:

add_filter( 'generate_sidebar_layout','generate_custom_events_sidebar_layout' );
function generate_custom_events_sidebar_layout( $layout )
{
 	// If we are on a tribe events page, set the sidebar
 	if ( 'tribe_events' == get_post_type() || is_post_type_archive( 'tribe_events' ) )
 	 	return 'no-sidebar';

 	// Or else, set the regular layout
 	return $layout;

 }

That works fine for the main page (Calendar): No-sidebar :-)
But for Single-Event page the Sidebar is there but no widget are shown.
My Calendar URL is http://lelaurier.net/calendrier/
The Single-Event URL are http://lelaurier.net/evenement/single-post-name/
(Snippet is not activated presently)
Any way to remove the Sidebar on the Calendar page and keep the Sidebar and Widgets on the Single-Event page?

Thanks

Hi tom,

You said "I believe the single event sidebars can be altered using the metabox". Yes, that is true, but it is the main calendar page that I do not have acces to "modifiy page".

What I want to do is remove the Sidebar on the Calendar (Main Tribe Events page) and keep the Sidebar and Widgets on the Single-Event page. In using the code above, it does work on all Tribe Events pages (With the particularity that on Single-Event page it does leave the Sidebar but there is no widget shown).

I did leave the Snippet activated for you to see.
Main page (Fine): http://lelaurier.net/calendrier/
Single-Page (Sidebar but no widget) : http://lelaurier.net/evenement/journee-de-golf-des-couples-club-de-golf-de-beloeil-le-14-aout/

Hmm, that's interesting. If you remove the function above, do widgets show on on your single event pages?

Sure same widgets show on the Single-Event pages and on Calendar pages.

Hi Tom,

Found a way to do what I wanted (No-sidebar on Calendar pages): if ( tribe_is_event_query() && (! is_singular()) )

BTW, only if ( tribe_is_event_query() ) does remove the sidebar on both Calendar pages and Single-Event pages.

Thanks again for your help.

Ah, glad you found the solution! :)

Hello,

I'm not a coder (just a designer) and wish to add a snippet that hides the sidebar on both the calendar view and single view...a go full-width on the views of course (no blank space on the side).

What would be the code and where should I add it please?

Thanks

Mo

Hi there,

Can you try this:

add_filter( 'generate_sidebar_layout','tu_custom_category_sidebar_layout' );
function tu_custom_category_sidebar_layout( $layout )
{
 	// If we are on a category, set the sidebar
 	if ( tribe_is_event_query() && ! is_singular() )
 	 	return 'no-sidebar';

 	// Or else, set the regular layout
 	return $layout;

}

Adding PHP: https://docs.generatepress.com/article/adding-php/

Hi Leo,

I did add the code through the plugin you mentioned.

Worked like a charm on the full calendar view :) but not on the single that still has a sidebar.

Any idea on how to delete this one too?

Thanks for your support.

Mo

Me again for some unknown reason I did change some of the parameters of the plugins and now I got the fullwidth view for the single too.

Thank you again :)

Glad I could help :)

This archived topic is closed to new replies.