mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-20 06:53:23 +09:00
move upload script enqueue to main class
(so it's available for both taxonomies and settings page)
This commit is contained in:
@@ -132,8 +132,6 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
'display_featured_image_section'
|
||||
);
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,25 +415,4 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* enqueue admin scripts
|
||||
* @return scripts to use image uploader
|
||||
*
|
||||
* @since 1.2.1
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$version = Display_Featured_Image_Genesis_Common::$version;
|
||||
|
||||
wp_register_script( 'displayfeaturedimage-upload', plugins_url( '/includes/js/settings-upload.js', dirname( __FILE__ ) ), array( 'jquery', 'media-upload', 'thickbox' ), $version );
|
||||
|
||||
if ( 'appearance_page_displayfeaturedimagegenesis' === get_current_screen()->id ) {
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'displayfeaturedimage-upload' );
|
||||
wp_localize_script( 'displayfeaturedimage-upload', 'objectL10n', array(
|
||||
'text' => __( 'Choose Image', 'display-featured-image-genesis' ),
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -77,25 +77,4 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enqueue admin scripts
|
||||
* @return scripts to use image uploader
|
||||
*
|
||||
* @since 1.2.1
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$version = Display_Featured_Image_Genesis_Common::$version;
|
||||
|
||||
wp_register_script( 'displayfeaturedimage-upload', plugins_url( '/includes/js/settings-upload.js', dirname( __FILE__ ) ), array( 'jquery', 'media-upload', 'thickbox' ), $version );
|
||||
|
||||
if ( ! empty( get_current_screen()->taxonomy ) ) {
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'displayfeaturedimage-upload' );
|
||||
wp_localize_script( 'displayfeaturedimage-upload', 'objectL10n', array(
|
||||
'text' => __( 'Choose Image', 'display-featured-image-genesis' ),
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ class Display_Featured_Image_Genesis {
|
||||
add_action( 'admin_menu', array( $this->settings, 'do_submenu_page' ) );
|
||||
add_action( 'get_header', array( $this->output, 'manage_output' ) );
|
||||
add_action( 'template_redirect', array( $this->rss, 'maybe_do_feed' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -147,4 +148,25 @@ class Display_Featured_Image_Genesis {
|
||||
load_plugin_textdomain( 'display-featured-image-genesis', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* enqueue admin scripts
|
||||
* @return scripts to use image uploader
|
||||
*
|
||||
* @since 1.2.1
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
$version = Display_Featured_Image_Genesis_Common::$version;
|
||||
|
||||
wp_register_script( 'displayfeaturedimage-upload', plugins_url( '/includes/js/settings-upload.js', dirname( __FILE__ ) ), array( 'jquery', 'media-upload', 'thickbox' ), $version );
|
||||
|
||||
if ( 'appearance_page_displayfeaturedimagegenesis' === get_current_screen()->id || ! empty( get_current_screen()->taxonomy ) ) {
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'displayfeaturedimage-upload' );
|
||||
wp_localize_script( 'displayfeaturedimage-upload', 'objectL10n', array(
|
||||
'text' => __( 'Choose Image', 'display-featured-image-genesis' ),
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user