Opened 11 years ago
Closed 9 years ago
#28746 closed feature request (fixed)
Add class argument to add_settings_field()
Reported by: | euthelup | Owned by: | |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | |
Focuses: | administration, template | Cc: |
Description
Hello!
I frequently find myself against this issue: I would like to control with javascript an entire option field and play with it but there is no way on making it unique.
So I came here (for the first time) and kindly ask you if we can have class argument on add_settings_field() function which should be put on the field's <tr> tag?
Is not a tremendous work you could replicate the "label_for" functionality, instead of :
echo '<tr>'; if ( !empty($field['args']['label_for']) ) echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>'; else echo '<th scope="row">' . $field['title'] . '</th>';
it should be :
if ( !empty($field['args']['class']) ) echo '<tr class="' . esc_attr( $field['args']['class'] ) . '">'; else echo '<tr>'; if ( !empty($field['args']['label_for']) ) echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>'; else echo '<th scope="row">' . $field['title'] . '</th>';
I still dream of the day when I can change myself the table markup to divs and spans but i guess it will remain a dream(and maybe this is not the topic to disqus that).
P.S: my first ticket, sorry for anything i miss and take me slow.
Best Regards,
Andrei Lupu
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hm, couldn't you select the label and then look for the closest
li
element?