Site logo

[Resolved] Adding CSS to hook

Home Forums Support [Resolved] Adding CSS to hook

Home Forums Support Adding CSS to hook

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2408811
    Charles

    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

    #2408831
    Leo
    Staff
    Customer Support

    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.

    #2408857
    Charles

    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

    #2408862
    Leo
    Staff
    Customer Support

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

    #2408876
    Charles

    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

    #2408878
    Leo
    Staff
    Customer Support

    You would just need to display: none; on the desktop breakpoint:
    https://docs.generatepress.com/article/responsive-display/

    #2408898
    Charles

    Great, thanks Leo

    Charles

    #2408983
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.