Archived topic
Disable/Hide specific Widget in Sidebar in WP posts
3 replies · Started by Max on June 26, 2019
Hi there!
I am using the latest GP Premium.
I browsed through the forum and took a look at several related posts but could not find a solution. I know how to insert Php and CSS but cannot write any meaningful code myself (except for some simple CSS changes).
What I would like to achieve:
I would like to disable/hide a specific widget (author box) which has been added to the sidebar but only when it comes to WP posts. At the same time I would like to keep the other widgets activated (e.g. a tag cloud). This is due to the fact that the widget is already being displayed under each posts and thus creates a duplicate. Simply removing it from the sidebar would not solve the problem since I need it to show on my website's pages. So it would be enabled on pages and disabled in posts.
Currently I am trying out some author widgets which is why two are being displayed in the right sidebar. The first is the one I want to hide in posts.
Your help would be much appreciated.
Best regards
Hi there,
Try this CSS:
body.single #right-sidebar .widget:first-child {
display: none;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know if this helps :)
Ok this was even beyond my expectations as far as the speed of a possible response is concerned.
It worked like a charm. Thanks Leo!
Glad I could help :)