Posted: May 5, 2020 at 8:15 am
|
Hi, I’m trying to add a sidebar to the single events pages. I can’t see how to do it using the Porto theme – am I missing something? I saw in a previous answer the poster was using Custom Sidebars plugin which seemed to work. In your answer you suggested: “create a new sidebar. Once created click sidebar locations, then choose “As Main Sidebar for selected Post Types” and then select Events.” I’ve tried the Custom Sidebars plugin and while ‘Events’ is available in post types. The post type for my EE events is: Type 1: Single Espresso_events This isn’t available to be selected in Custom Sidebars post types. thanks for your help |
Hi Phil, It depends what the theme is doing as that crontol the output of the sidebars, the plugin suggested just allows for more flexibility behind that. Can you send me a copy of the theme so I can take a quick look? You’ll need to host the zip and post the link here to download (you can mark you reply private so only EE staff can see it if preferred). |
|
Hi there, Have you tried using the search tool when adding widgets to the Custom Sidebar? Here are some screenshots of the Custom Sidebar settings on my site, using the conditionals to show a widget based on the single event names: Does that help at all? |
|
|
This reply has been marked as private. |
Ok, I’ve only quickly browsed over the code in Porto but I think it would good to explain a little about how sidebars are output as it ties into all of this. In short, EE does not control the output on your site, your theme does. So when you load an event your theme outputs that event using whatever template it is set up use and that template controls the vast majority of what you see. Now, there are hooks within WordPress (and themes/plugins) that allow for flexibility but ultimately your theme decides what is output and which of those hooks ‘run/fire’ in certain cases. So the custom sidebar plugin allows you to control the sidebar that would load/show as selectable but your theme still needs to call a sidebar for that to be output (if it is calling a global sidebar that plugin could hook in and change that based on the post type) but as far as I can tell, for the event output no sidebar is called at all and that is why you don’t see anything. So, may I ask, do you need custom sidebars or are you simply wanting to load a sidebar for events? |
|
|
Thank you very much for your help Tony. To answer your question – the latter – I’m simply wanting to load a sidebar for events Cheers, |
|
I asked the Porto support if they could assist – and they said no! – as it’s a plugin issue regarding your question Tony? >>>So, may I ask, do you need custom sidebars or are you simply wanting to load a >>>sidebar for events? I’m simply wanting to load a sidebar – is there away i can do this? thank you Phil |
|
just to repeat I’m simply wanting to load a sidebar – is there away i can do this? thank you Phil |
Of course, even though the output is controlled by the theme.
The most basic method is to simply call the sidebar itself from within a custom template but I didn’t want to just post that reply as it means you need to then start digging into managing more of the templates loaded. So after digging through Porto’s code to figure out what it was doing to load the sidebar(s) I found a way to filter the settings and load a specific post layout and sidebar using a filter (meaning no additional changes needed to the theme). You’ll need to add this snippet to your site: https://gist.github.com/Pebblo/36e25d7c662a6f4c9a2e09a219e66fe4 If you are using a child theme you can add it to your child theme’s functions.php file, if not, create a custom functions plugin and add it to that, we have some documentation on creating one here: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site On THIS LINE you’ll need to set the slug of the sidebar you want to display on the EE events. If you have an ‘Event Sidebar’ it will likely be ‘event-sidebar’. Notice how that filter has almost nothing to do with Event Espresso, its filtering settings within the Porto theme and explicitly setting the layout and sidebar when viewing a single event. Porto theme support would have known about the available filters much easier than I and could have simply pointed you in that direction.
Just a quick note that ‘bumping‘ your threads will effectively put your thread to the back of the queue as we work through the forums based on reply date. |
|
|
Thank you very much Tony – that works! Apologies for bumping, I was being way too impatient and wrongly thought my question had perhaps got lost and forgotten about. Sorry! |
You’re most welcome. With regard to bumping, its no problem for us I’m just letting you know that it basically has the opposite effect than intended for future reference. One of the reasons this took longer is officially the answer would be to contact Porto support as this really does have very little to do with Event Espresso. However, I suspected they’d simply blame EE (as they did) so wanted to find a workable solution for you that was a little better than taking over the template and forcing the sidebar into that. Problem with that is this would be considered outside of the scope of support for EE so had to wait until I could allocate some time to investigate, I didn’t do a very good job of communicating that with you here so my apologies for the wait. |
|
The support post ‘Add Sidebar – single event – Porto theme’ 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.