Hi @harm10,
The WPConsent banner is loaded using the Shadow DOM to avoid styles from the theme spilling into the banner, thus ensuring compatibility with any theme. This comes with some limits to what you can customize via regular CSS approaches.
We added “part” parameters to all the important elements of the Banner and Preferences panel to make customization easier. These can be used to target specific elements.
In your case, for the buttons you can use the following code to change the font family of all the buttons:
::part(wpconsent-button-preferences),
::part(wpconsent-button-cancel),
::part(wpconsent-button-accept) {
font-family: Courier;
}
Just replace Courier with your desired font family.
We’ll look into making the buttons follow the same approach as the banner that inherits the styles for easier setup in a future version.
Thanks,
Mircea
Thread Starter
Harm10
(@harm10)
@gripgrip Thanks for your reply. Where do I put (or find) these part parameters?
-
This reply was modified 7 months, 2 weeks ago by
Harm10.
Hi @harm10,
You can use the CSS code that I shared to change the styles for the buttons you indicated. You can find the part parameters by inspecting the banner in your browser using the browser Inspect Element option. If you want to read more about how that works please check this article: https://www.wpbeginner.com/wp-tutorials/basics-of-inspect-element-with-your-wordpress-site/
Thread Starter
Harm10
(@harm10)
@gripgrip I put the css code in the style.css of my child theme and then it works!
I was too fast. It works on the buttons of the consent banner but not if I select the Settings pop-up. The buttons there are unchanged.
Again too fast………… 🙁
You need to add the parts of these 3 buttons as well:
::part(wpconsent-button-preferences),
::part(wpconsent-preferences-save-button),
::part(wpconsent-preferences-cancel-button),
::part(wpconsent-preferences-accept-button),
::part(wpconsent-button-cancel),
::part(wpconsent-button-accept) {
font-family: Courier;
}
-
This reply was modified 7 months, 2 weeks ago by
Harm10.
-
This reply was modified 7 months, 2 weeks ago by
Harm10.