-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to disable / enable where in site the sidebar (and its associated code) loads #114
Comments
|
I see you've also added this here now haha. Alright, first things first, I consider this advanced usage and will only implement this in code, not through the UI. I think this is best done through filters and I can think if a two:
What do you think? |
|
Hi @JoryHogeveen. Thanks for giving this consideration. Yes, I think having a couple of filters as you've suggested would be handy for this purpose. I totally understand that this is likely something most users won't bother with (although they likely should ... because, for optimisation purposes, I think it's important to be able to cut back how much extraneous code is loading site-wide for features that might only be used on a single page or two ... I come across so many plugins and page builders etc., that load a heap of code and CSS files which are unnecessary much of the time... but that's another story for another day!). So yes, only being able to do this via code is totally fine with me, and would be great. |
|
I can understand what you mean regarding optimizing asset loading. Most users use this plugin for an off-canvas menu I suppose but yes, having a bit more control of what is happening is always nice. I've added the suggested filters for v0.5.8. Let me know! |
|
I didn't hear from you anymore, can you please let me know if the update works for you? Branch: https://github.com/JoryHogeveen/off-canvas-sidebars/tree/dev Let me know! |
|
Closing topic as fixed in 0.5.8 |
Description
Describe the solution you'd like
Currently sidebars are either enabled site-wide or disabled site-wide.
I can think of plenty of situations where it's not necessary to have a sidebar enabled site-wide. For example, I have a sidebar set up for the Woocommerce search results and shop pages. I don't need the sidebar code loaded on any other pages, including homepage, checkout pages, single product pages, etc. So it is unnecessarily adding additional weight to those pages.
Is your feature request related to a problem? Please describe.
The problem is simply that it's inefficient to be loading all the sidebar data/code on pages where the sidebar isn't needed.
Other notes
Describe alternatives you've considered
I can set up some PHP to conditionally control when OCS can and can't load, as mentioned here.
Which is fine when only using one sidebar used on one set of pages on the site. But that would be come unwieldy to do when handling multiple sidebars, intended to display on different sets of pages.
Also, I see that wordpress.org user "dvieira" reports that the JS and CSS still loads, even when the sidebar is programatically disabled.
The text was updated successfully, but these errors were encountered: