Archived topic
Format only widget content
3 replies · Started by Agnes on January 16, 2019
Hello,
I hope you have a great day.
I would like to add a class after the widget title in the sidebar, so I can format separately the content of the widget. (adding a background color, but leaving the widget title with a transparent background)
I found the hook before_right_sidebar_content and I was happy, that this is it, I will hook a new class here, but it is for the whole sidebar content, not the widgets.
I am not sure how to solve this problem, any idea is highly appreciated.
I could still format every widget used in the sidebar separately though, but I am hoping you have a more elegant solution.
Thanks,
all the best,
Agnes
this is the site I intend to recreate with Generatepress, so you can see the sidebar formatting I am trying to achieve: https://sallymorris.co.uk/
Hi there,
you could try removing the padding and background colors from your sidebar widgets and then use this CSS:
#right-sidebar .widget-title + * {
background-color: red; /* Set color */
padding: 10px; /* set padding for widget content */
}
It will only apply the styles to content IF it comes after a title but won't apply to the Title itself.
Thank you, it works brilliantly!!!
Glad to be of help