[Resolved] Hooks Element styling with css

Home Forums Support [Resolved] Hooks Element styling with css

Home Forums Support Hooks Element styling with css

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1553549
    Baz

    I’m trying to get my head around the Hooks Element feature in GP. I usually create widget areas using the standard register_sidebar( array( function, and then use the <div class="after-entry-widget"> to style the widget area using css e.g. background-color, padding etc.

    So, if I wanted to create an after entry widget area in GP, what and where would I enter some code so that I can target this area with CSS?

    Finally, is there an advantage to using the Hooks Element vs registering sidebars the old-fashioned way?

    Thanks.

    #1555361
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    To actually register the widget area, you’d want to use a regular functions file or code snippets.

    Hooks are a great way to display the widget area once it’s been registered.

    When displaying the area, you can wrap it in a container with a class so you’re able to target it with CSS.

    Hope this helps!

    #1555389
    Baz

    Thanks Tom.

    I thought Elements was a way to create widget areas ๐Ÿ™‚

    I suppose it’s more suited to inserting code/snippets within certain areas/hooks of the theme. So, if you are comfortable with PHP and targeting hooks, I guess you can do without activating the Elements module.

    Cheers.

    #1556941
    Tom
    Lead Developer
    Lead Developer

    If you’re comfortable writing hooks and filters, then you can likely skip Elements. However, the Display Rules are very convenient, especially when dealing with multiple conditions. Sometimes it’s easier to use them than write your own conditions ๐Ÿ™‚

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