Twenty Fourteen: implement tag auto-complete for featured content settings, and uppercase `__CLASS__` for consistency. Props kovshenin, see #25549.

git-svn-id: https://develop.svn.wordpress.org/trunk@25813 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2013-10-16 18:26:04 +00:00
parent aa5c907e40
commit 324ac5177f
2 changed files with 8 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class Featured_Content {
* All custom functionality will be hooked into the "init" action.
*/
public static function setup() {
add_action( 'init', array( __class__, 'init' ), 30 );
add_action( 'init', array( __CLASS____, 'init' ), 30 );
}
/**
@ -308,8 +308,8 @@ class Featured_Content {
* @return void
*/
public static function register_setting() {
add_settings_field( 'featured-content', __( 'Featured content', 'twentyfourteen' ), array( __class__, 'render_form' ), 'reading' );
register_setting( 'reading', 'featured-content', array( __class__, 'validate_settings' ) );
add_settings_field( 'featured-content', __( 'Featured content', 'twentyfourteen' ), array( __CLASS__, 'render_form' ), 'reading' );
register_setting( 'reading', 'featured-content', array( __CLASS__, 'validate_settings' ) );
}
/**
@ -326,6 +326,8 @@ class Featured_Content {
if ( ! is_wp_error( $tag ) && isset( $tag->name ) )
$tag_name = $tag->name;
}
wp_enqueue_script( 'twentyfourteen-admin', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20131016', true );
?>
<div id="featured-content-ui">
<p>

View File

@ -0,0 +1,3 @@
jQuery( document ).ready( function( $ ) {
$( '#featured-content-tag-name' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2 } );
} );