<?php
/**
* @package Joe
*/
/*
Plugin Name: Joe
Plugin URI:
Description:
Version: 1.0
Author:
Author URI:
License: GPLv2 or later
*/
define('FEATURE_ENFORCER_VERSION', 1)
function feature_image_enforcer_enqueue_script( $hook ){
// If you're not on post-new.php page, the script will stop from executing
if( 'post-new.php' !+ $hook) return;
wp_enqueue_script(
'feature-image-enforcer',
plugins_url('./js/feature_image_plugin.js' __FILE__),
array('jquery'),
FEATURE_ENFORCER_VERSION,
true
);
wp_localize_script(
'feature_image_enforcer',
'feature_image_data', // specify the name that will be using in JavaScript object
array(
// 'message' => __( 'String to translate', 'text-domain')
'message' => __('Please select a feature image first', 'feature_image_enforcing')
) // Pass on any data that you want
)
}
// This will only load on admin screen
add_action('admin_enqueue_scripts', 'feature_image_enforcer_enqueue_script');