• Skip to main content
  • Skip to forum navigation

StudioPress

  • Create a Site
  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Discussion
  • Design Tips
  • Showcase/Feedback
  • FAQs
  • Forum Rules
  • Forum Log In

Atomic Blocks Update – Advanced Post Grid!

Atomic Blocks, our leading Gutenberg blocks plugin, has just received a fantastic new update – an all new, powerful, post grid!

Read More

Add a text field to each widget control form

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › General Discussion › Add a text field to each widget control form

This topic is: resolved

Tagged: dynamic_sidebar_params

This topic contains 6 replies, has 3 voices, and was last updated by  Anita 2 weeks, 6 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • November 24, 2019 at 9:57 pm #495018

    Fabio Nodari
    Participant

    Hi,
    I'd like to know if there is any code I can add to the function.php file to add a text field to each widget control form on my widget admin page.
    I currently do this using the ZigWidgetClass plugin. But if I can implement what he does without using a plugin would be better. I also honestly think this is a neat function that should be implemented in the framework and it shouldn't be too difficult.

    With this text field I can enter a CSS class name in the box and it will be added to the classes that WordPress applies to that widget instance. To add multiple classes I can simply separate them with a space.


    My photography website and Travel Blog | My Instagram

    November 25, 2019 at 12:50 am #495021

    braddalton
    Participant

    You could try the dynamic_sidebar_params hook which filters the parameters passed to a widget’s display callback.

    You can use this filter with specific widget id's.


    Access 6000+ Custom Code Snippets for Genesis

    November 25, 2019 at 1:05 am #495023

    Fabio Nodari
    Participant

    Sorry but I am quite a noob. How can I actually add the text field to the widget?


    My photography website and Travel Blog | My Instagram

    November 25, 2019 at 1:16 am #495024

    braddalton
    Participant

    Thats hook enables you to add the class directly to the widget without adding a custom field to each widget and the adding the class manually.

    You could do it using 1 filter function.

    You can search for dynamic_sidebar_params and might find some code which provides the solution you want.


    Access 6000+ Custom Code Snippets for Genesis

    November 25, 2019 at 1:25 am #495025

    Fabio Nodari
    Participant

    Ok thanks! Will do


    My photography website and Travel Blog | My Instagram

    November 25, 2019 at 2:33 am #495026

    Fabio Nodari
    Participant

    Just realized that I could achieve the same result exclusively using css. 🙂 Thanks anyway


    My photography website and Travel Blog | My Instagram

    November 25, 2019 at 8:55 am #495036

    Anita
    Moderator

    @nfabiox85 if you start using the block editor to build, the blocks have additional css fields for you to name blocks so you can code them in the stylesheet. It's really pretty nice. I think the goal for WordPress is to move completely away from widgets, but that's down the road.


    Need Something Coded Up? Reach out to me! Website: cre8tivediva.com | Twitter: @TheCre8tiveDiva
    Find my WordPress and Genesis tutorials here.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Add a text field to each widget control form’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2019 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble