Archived topic
sticky sidebars
37 replies · Started by Kris on July 13, 2020
I would love it if GeneratePress had a built-in sticky function for sidebars. Most of the sites we create have them.
Its something we're looking at for the future maybe - but the additional CSS is real simple especially on a new GP 3.0+ Theme install. Anything particular you need a hand with?
We'd really really like to have a checkbox to keep the sidebars (or header) sticky. Adding CSS gets messy at some point. ;-)
Hi David,
amazing!
But here's a thing. I don't want the whole sidebars to stay sticky because there are ads in my sidebars which I do not want to be sticky as it violates the google ads policy. (i don't wanna take the risk)
Is there a way that I can use to make a specific widget "not to be sticky" (like in this case, my ads widget)
Thanks
Hi Den,
Instead of making the whole sidebar sticky, you could try to make the widgets (except the ad widget) all sticky.
You could open a new topic along with your site info in private info field if you need further assistance.
Let me know :)
Hi ying,
but how to do it?
can you provide me the css code in which i can add the class of those widgets that i want to be sticky
Can't provide code without seeing your site, that's why I asked you to open a new support topic, so you could use the private info field to link us to your site. :)
As a side note, when will you update so that blocks replace widgets? Widgets are not future-proof, they are legacy, and we want to develop sites using blocks, which is how WordPress will function in the future. Thanks!
Hi there,
re: block widgets i answered that question here:
https://generatepress.com/forums/topic/switching-header-from-widgets-to-blocks/#post-1661930
Thank you for this! I am on a complete plugin diet building mission and I just keep on finding straight forward solutions for GP to do this with simple css or just plain old functions that does it without comprimising the speed of the site. THANK YOU!!! This helped me big time.
Glad to hear that!
Hi David,
thanks a lot, this is exactly what I was looking for.
Only one more thing:
If the last widget is larger than the height of the screen (for example when using table of contents in a big article), right now it is not possible to scroll down to the bottom, because the widget is fixed on top.
Is it possible, that the bottom of the widget is fixed instead of the top?
Hi Tobias,
not sure about that - if you want to raise a new topic and share a link to the site where i can see the sidebar then i can take a look at some options.
Dear lord thank you so much for this. I spent 2 days trying to figure out how to do this with a plugin and I was pulling my hair out.
David, is there a way to finagle this CSS to work with a TOC sidebar widget created using a Generate Press element? I want my table of contents widget (manually created, no plugin used) to be sticky in my right sidebar.
I'm using a different sidebar for this specific post, vs the rest of my site which uses my standard sidebar.
The page isn't live yet so I can't share it with you.