Support

Home Forums Event Espresso Premium How to hide sidebar in all EE associated pages?

How to hide sidebar in all EE associated pages?

Posted: April 14, 2015 at 3:35 pm

Viewing 11 reply threads


meremetia

April 14, 2015 at 3:35 pm

Hi, I’d like to hide my theme’s sidebar in every page that has to do with EE, is there a way to do it?

thanks


Dean

April 15, 2015 at 3:05 am

Hi,

There’s a couple of things you would need to do.

1) Set any Event Espresso related pages (e.g. Registration Checkout) to use a full width Page template. Most themes come with one, but if yours does not, then you would need to create a full width page template for your theme.

2) For Events (which are a custom post type), copy the following files to your theme (ideally to a child theme):

/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/archive-espresso_events.php
/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/single-espresso_events.php

(you can copy the venue ones as well if you need to).

Then edit the above files in your theme folder and remove or comment out the following:

get_sidebar( 'content' );
get_sidebar();

You will likely need to then add new classes/ID’s to the wrapping divs and then add new CSS in order to change the width of the content, as while removing the above will remove the sidebars, it will not automatically change the width.

Also, copy the espresso_pagination function found in /wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/functions.php to your theme/child theme’s functions.php file.

That should get you started with removing sidebars for just Event related pages and posts.


meremetia

April 15, 2015 at 8:32 am

Hi Dean,
Thanks for the fast reply. I faced the following issue:
I am using the following code in my function.php to change the position of ticket. After I followed the instructions above, my ticket area appears twice.

Does the code below have to be modified to support the change of template?

add_filter ('the_content', 'my_remove_event_tickets', 100 );

// remove tickets
function my_remove_event_tickets( $content ) {
    if ( 'espresso_events' == get_post_type() && is_singular() && !post_password_required() ) {
        remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 );
        add_filter( 'the_content', 'my_add_event_tickets', 121);
    }
    return $content;
}

// add tickets after the content
function my_add_event_tickets( $content ) {
    return $content . EEH_Template::locate_template( 'content-espresso_events-tickets.php' );
}

/**

thanks


Lorenzo Orlando Caum

  • Support Staff

April 15, 2015 at 10:27 am

Hi, is the current issue that your ticket selector is appearing twice?

Was the sidebar already removed in your earlier steps?


Lorenzo


meremetia

April 15, 2015 at 10:42 am

Hi, yes, the sidebar was removed successfully, but at the same time the ticket selector starting appearing twice.

thx


Lorenzo Orlando Caum

  • Support Staff

April 15, 2015 at 11:41 am

Hi, could you temporarily remove the filters and let us know what happens?

https://eventespresso.com/topic/how-to-hide-sidebar-in-all-ee-associated-pages/#post-151817


Lorenzo


meremetia

April 15, 2015 at 12:17 pm

without the filters:
– the ticket selector appears once at its default position (Before content)
– no sidebars


Lorenzo Orlando Caum

  • Support Staff

April 15, 2015 at 12:29 pm

Hi there,

Could you share a link to an event so we can take a look at this issue?

The filters were created for a default WP theme so your theme may be working a little differently.

If you do not want to share this link here in our support forums then please email the link to the email address below and also include a link to this support post.

support [at] eventespresso.com

Thanks!


Lorenzo


meremetia

April 21, 2015 at 2:10 pm

hi, I just dropped you an email.
To recap: I am using the above filters to move the ticket selector below the content, which works fine.

However, the moment I copy the templates to my theme directory (to remove the sidebars), the ticket selector start appearing twice.

best regards


Lorenzo Orlando Caum

  • Support Staff

April 21, 2015 at 2:18 pm

Hi, during this step, are you swapping in the line for Event Espresso?

However, the moment I copy the templates to my theme directory (to remove the sidebars), the ticket selector start appearing twice.

If not, please try these steps:

https://gist.github.com/lorenzocaum/16aac08f099d7c154f04


Lorenzo


meremetia

April 21, 2015 at 3:46 pm

hi, yes I do.

I just want to make clear that I am able to remove the sidebards and/or modify the template in any way, the problem is that the ticket-selector appears twice.

That probably means that the my_remove_events_ticket I am using (https://eventespresso.com/topic/how-to-hide-sidebar-in-all-ee-associated-pages/#post-151817) stops working the moment that a single-espresso_events.php is present in theme dir.

I do not know why/how I should modify the filter in order to work

thanks


Tony

  • Support Staff

April 23, 2015 at 3:51 am

The problem with using the Arabica theme files in this situation is that those 2 files call the template files within the EE4 directory which then adds is own call for the ticket selector that isn’t using a filter, so then your function doesn’t work on that ticket selector.

There are two ways to work around this, you can either use more of the Arabica files (recommended to do so within a child theme) and edit the order using those, this has the same effect as the filter but you’ll need to manually change the load order within the templates.

Or

Copy your current themes template file and add ‘-espresso_events’ to the files, then you can make the same edit Dean recommended above. So for example, with twentyfourteen and editing single.php:

Copy single.php – http://take.ms/8SOLo
Rename the copy to single-espresso_events.php – http://take.ms/Ay6S5
Within that file comment out the sidebar calls – http://take.ms/Nlelh

The sidebar should then be removed from the single events. You can also do exactly the same with archive.php for event list.

Again you would likely need to add classes/ID’s to the wrapping divs and then add new CSS to make this full width.

Before making any changes it is recommended to make a full site backup.

Viewing 11 reply threads

The support post ‘How to hide sidebar in all EE associated pages?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso