Site logo

Archived topic

Adding CSS to hook

7 replies · Started by Charles on November 9, 2022

Viewing posts 1–8 of 8

Hi there,

I'm looking to make a few adjustments to a banner ad I've just added to my website via the generate_after_header hook.

I would like to disable the ad on desktop, center align and add some padding at the top.

If you could help that would be great.

Charles

Hi Charles,

CSS should be added using one of the methods here and not through a GP hook:
https://docs.generatepress.com/article/adding-css/

The Additional CSS field is a WP core option so that would be my recommendation unless you are using a child theme already.

Hi Leo,

Thanks for the advice.

Do I need to give the hook a class and what CSS would I use to make the above changes?

Charles

I don't see a class for the ad so a class would certainly be helpful.

Hi Leo,

I've added a class and made a couple of changes to the ad. However, I'm unsure how to disable on desktop?

Charles

Great, thanks Leo

Charles

No problem :)

This archived topic is closed to new replies.