Twenty Fourteen: implement tag auto-complete for featured content settings, and uppercase `__CLASS__` for consistency. Props kovshenin, see #25549.
Built from https://develop.svn.wordpress.org/trunk@25813 git-svn-id: http://core.svn.wordpress.org/trunk@25725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
085f5c5fb9
commit
fafbee59f9
|
@ -30,7 +30,7 @@ class Featured_Content {
|
||||||
* All custom functionality will be hooked into the "init" action.
|
* All custom functionality will be hooked into the "init" action.
|
||||||
*/
|
*/
|
||||||
public static function setup() {
|
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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function register_setting() {
|
public static function register_setting() {
|
||||||
add_settings_field( 'featured-content', __( 'Featured content', 'twentyfourteen' ), array( __class__, 'render_form' ), 'reading' );
|
add_settings_field( 'featured-content', __( 'Featured content', 'twentyfourteen' ), array( __CLASS__, 'render_form' ), 'reading' );
|
||||||
register_setting( 'reading', 'featured-content', array( __class__, 'validate_settings' ) );
|
register_setting( 'reading', 'featured-content', array( __CLASS__, 'validate_settings' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,6 +326,8 @@ class Featured_Content {
|
||||||
if ( ! is_wp_error( $tag ) && isset( $tag->name ) )
|
if ( ! is_wp_error( $tag ) && isset( $tag->name ) )
|
||||||
$tag_name = $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">
|
<div id="featured-content-ui">
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -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 } );
|
||||||
|
} );
|
Loading…
Reference in New Issue