mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-11 18:46:03 +09:00
set plugin version as variable for enqueues to use
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
*/
|
||||
class Display_Featured_Image_Genesis_Common {
|
||||
|
||||
/**
|
||||
* current plugin version
|
||||
* @var string
|
||||
*/
|
||||
public static $version = '1.4.2';
|
||||
|
||||
/**
|
||||
* set and retreive variables for the featured image.
|
||||
* @return $item
|
||||
|
||||
@@ -35,7 +35,8 @@ class Display_Featured_Image_Genesis_Output {
|
||||
*/
|
||||
public function load_scripts() {
|
||||
|
||||
$item = Display_Featured_Image_Genesis_Common::get_image_variables();
|
||||
$version = Display_Featured_Image_Genesis_Common::$version;
|
||||
$item = Display_Featured_Image_Genesis_Common::get_image_variables();
|
||||
|
||||
// if there is no backstretch image set, or it is too small, die
|
||||
if ( empty( $item->backstretch ) || $item->backstretch[1] <= $item->medium ) {
|
||||
@@ -44,12 +45,12 @@ class Display_Featured_Image_Genesis_Output {
|
||||
// if the featured image is not part of the content, or we're not on a singular page, carry on
|
||||
if ( false === $item->content || ! is_singular() ) {
|
||||
|
||||
wp_enqueue_style( 'displayfeaturedimage-style', plugins_url( 'includes/css/display-featured-image-genesis.css', dirname( __FILE__ ) ), array(), '1.4.2' );
|
||||
wp_enqueue_style( 'displayfeaturedimage-style', plugins_url( 'includes/css/display-featured-image-genesis.css', dirname( __FILE__ ) ), array(), $version );
|
||||
|
||||
//check if the image is large enough for backstretch
|
||||
if ( $item->backstretch[1] > $item->large ) {
|
||||
wp_enqueue_script( 'displayfeaturedimage-backstretch', plugins_url( '/includes/js/backstretch.js', dirname( __FILE__ ) ), array( 'jquery' ), '1.4.2' );
|
||||
wp_enqueue_script( 'displayfeaturedimage-backstretch-set', plugins_url( '/includes/js/backstretch-set.js', dirname( __FILE__ ) ), array( 'jquery', 'displayfeaturedimage-backstretch' ), '1.4.2' );
|
||||
wp_enqueue_script( 'displayfeaturedimage-backstretch', plugins_url( '/includes/js/backstretch.js', dirname( __FILE__ ) ), array( 'jquery' ), $version, true );
|
||||
wp_enqueue_script( 'displayfeaturedimage-backstretch-set', plugins_url( '/includes/js/backstretch-set.js', dirname( __FILE__ ) ), array( 'jquery', 'displayfeaturedimage-backstretch' ), $version, true );
|
||||
|
||||
wp_localize_script( 'displayfeaturedimage-backstretch-set', 'BackStretchVars', array(
|
||||
'src' => esc_url( $item->backstretch[0] ),
|
||||
|
||||
@@ -357,7 +357,9 @@ class Display_Featured_Image_Genesis_Settings {
|
||||
* @since 1.2.1
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
wp_register_script( 'displayfeaturedimage-upload', plugins_url( '/includes/js/settings-upload.js', dirname( __FILE__ ) ), array( 'jquery', 'media-upload', 'thickbox' ), '1.0.0' );
|
||||
$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();
|
||||
|
||||
Reference in New Issue
Block a user