Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Gary Stewart
Gary Stewart
14,142 Points

Best way to program dynamic wordpress widget settings?

I am currently developing my first widget plugin for Wordpress, everything is working as I would like although I am a little stumped as to how I can program my back-end widget settings.

At the moment I have the following Options/form fields on the back end widget settings:

//// Widget Title Widget Text Widget Background Colour Select Widget Design

Widget Design 1 Options

Widget Design 2 Options ////

What I would like is for only one widget design options to be displayed depending on which widget design is selected if that makes sense?

For example if from the main settings 'widget design 1' was selected -> then show widget design 1 options below and don't display widget design 2 options, and so on......

I have tried and failed with some PHP if statements and jQuery but with no luck so was wondering if anyone had a recommendation on how to achieve this best?