From b95d99d1c1b8493a07e3540e026261911c4d1fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= Date: Thu, 26 Feb 2015 19:59:25 +0000 Subject: [PATCH] Settings API: Allow passing a class to `add_settings_field()` via the `$args` array. While it's possible to target the wrapper element otherwise (currently a `tr`), this deficiency is made especially noticeable when custom code cannot take advantage of what core is doing, such as with avatars in #30168. props valendesigns. fixes #28975. see #30168. Built from https://develop.svn.wordpress.org/trunk@31560 git-svn-id: http://core.svn.wordpress.org/trunk@31541 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 15 ++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 0c5658cc0e..be58e75866 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1289,11 +1289,20 @@ function do_settings_fields($page, $section) { return; foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { - echo ''; - if ( !empty($field['args']['label_for']) ) + $class = ''; + + if ( ! empty( $field['args']['class'] ) ) { + $class = ' class="' . esc_attr( $field['args']['class'] ) . '"'; + } + + echo ""; + + if ( ! empty( $field['args']['label_for'] ) ) { echo ''; - else + } else { echo '' . $field['title'] . ''; + } + echo ''; call_user_func($field['callback'], $field['args']); echo ''; diff --git a/wp-includes/version.php b/wp-includes/version.php index d04abe055b..612040b106 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31559'; +$wp_version = '4.2-alpha-31560'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.