- This topic has 11 replies, 4 voices, and was last updated 5 years, 10 months ago by Leo.
-
AuthorPosts
-
August 11, 2016 at 6:55 pm #217559Louis
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
August 11, 2016 at 8:09 pm #217567TomLead DeveloperLead DeveloperHi there,
I believe the single event sidebars can be altered using the metabox: https://generatepress.com/knowledgebase/choosing-sidebar-layouts/#metabox
Let me know π
August 12, 2016 at 7:00 am #217672LouisHi 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/August 12, 2016 at 8:59 am #217696TomLead DeveloperLead DeveloperHmm, that’s interesting. If you remove the function above, do widgets show on on your single event pages?
August 12, 2016 at 10:43 am #217714LouisSure same widgets show on the Single-Event pages and on Calendar pages.
August 12, 2016 at 11:46 am #217741LouisHi 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.
August 12, 2016 at 8:00 pm #217782TomLead DeveloperLead DeveloperAh, glad you found the solution! π
June 27, 2018 at 3:19 pm #610203MohammedHello,
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
June 27, 2018 at 8:05 pm #610327LeoStaffCustomer SupportHi 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/
June 28, 2018 at 12:34 am #610430MohammedHi 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
June 28, 2018 at 12:47 am #610437MohammedMe 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 π
June 28, 2018 at 8:29 am #610847LeoStaffCustomer SupportGlad I could help π
-
AuthorPosts
- You must be logged in to reply to this topic.