Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


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?