Changeset 31095 for trunk/src/wp-admin/options-discussion.php
- Timestamp:
- 01/08/2015 05:00:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options-discussion.php
r30089 r31095 14 14 $title = __('Discussion Settings'); 15 15 $parent_file = 'options-general.php'; 16 17 /** 18 * Display JavaScript on the page. 19 * 20 * @since 4.2.0 21 */ 22 function options_discussion_add_js() { 23 ?> 24 <script> 25 (function($){ 26 var parent = $( '#show_avatars' ), 27 children = $( '.avatar-settings' ); 28 parent.change(function(){ 29 children.toggleClass( 'hide-if-js', ! this.checked ); 30 }); 31 })(jQuery); 32 </script> 33 <?php 34 } 35 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' ); 16 36 17 37 get_current_screen()->add_help_tab( array( … … 173 193 <p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p> 174 194 175 <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?> 195 <?php 196 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? 197 198 $show_avatars = get_option( 'show_avatars' ); 199 ?> 176 200 177 201 <table class="form-table"> … … 180 204 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend> 181 205 <label for="show_avatars"> 182 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( get_option('show_avatars'), 1 ); ?> />206 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> /> 183 207 <?php _e( 'Show Avatars' ); ?> 184 208 </label> 185 209 </fieldset></td> 186 210 </tr> 187 <tr >211 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>"> 188 212 <th scope="row"><?php _e('Maximum Rating'); ?></th> 189 213 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend> … … 208 232 </fieldset></td> 209 233 </tr> 210 <tr >234 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>"> 211 235 <th scope="row"><?php _e('Default Avatar'); ?></th> 212 236 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend> … … 240 264 $size = 32; 241 265 $avatar_list = ''; 266 267 // Force avatars on to display these choices 268 add_filter( 'pre_option_show_avatars', '__return_true', 100 ); 269 242 270 foreach ( $avatar_defaults as $default_key => $default_name ) { 243 271 $selected = ($default == $default_key) ? 'checked="checked" ' : ''; … … 250 278 $avatar_list .= '<br />'; 251 279 } 280 281 remove_filter( 'pre_option_show_avatars', '__return_true', 100 ); 282 252 283 /** 253 284 * Filter the HTML output of the default avatar list.
Note: See TracChangeset
for help on using the changeset viewer.