Plugin options page: grouping checkboxes
-
I’ve been using the WordPress Option Page Generator by Jeremy Hixon to help give me a head start with my plugin’s option page. I’ve laid out four different types of checkboxes which the source code can be found here:
https://gist.github.com/factmaven/3896a3aac3888aa5bcddae48d9da5238
However, I’d like to add additional checkboxes in each of the four section that I’ve made, like so:
https://i.stack.imgur.com/jlxOT.jpg
Based on the generator, it looks like I would need to add another
add_settings_field
and another callback function to add more checkboxes; but that looks more tedious than I’d imagine just to add more checkboxes under each section. Is it possible to add additional checkboxes underneath theadd_settings_field
that I’ve already created? For example:public function personal_options_0_callback() { printf( '<input type="checkbox" name="profile_settings_option_name[personal_options_0]" id="personal_options_0" value="personal_options_0" %s> <label for="personal_options_0"> Visual Editor</label>', ( isset( $this->profile_settings_options['personal_options_0'] ) && $this->profile_settings_options['personal_options_0'] === 'personal_options_0' ) ? 'checked' : '' ); printf( '<input type="checkbox" name="profile_settings_option_name[personal_options_1]" id="personal_options_1" value="personal_options_1" %s> <label for="personal_options_1"> Admin Color Scheme</label>', ( isset( $this->profile_settings_options['personal_options_1'] ) && $this->profile_settings_options['personal_options_1'] === 'personal_options_1' ) ? 'checked' : '' ); }
Any help or guidance is appreciated. I’ve never made a plugin options page before, so if there is a simpler way of doing this, I am also open to your recommendation.
If you’re on the WordPress Stack Exchange, I’ve also made the topic there if it’s better to respond there:
https://wordpress.stackexchange.com/questions/235267/plugin-options-page-grouping-checkboxes
- The topic ‘Plugin options page: grouping checkboxes’ is closed to new replies.