Update to filesystem path instead of URL
This commit is contained in:
parent
53c5e2102f
commit
213091155a
1 changed files with 4 additions and 3 deletions
|
|
@ -112,13 +112,14 @@ class JobMetaboxes {
|
||||||
global $post_type;
|
global $post_type;
|
||||||
|
|
||||||
if ( 'job' === $post_type && ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) ) {
|
if ( 'job' === $post_type && ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) ) {
|
||||||
$script_path = plugin_dir_url( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js';
|
$script_url = plugin_dir_url( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js';
|
||||||
|
$script_local_path = plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.js'; // File system path
|
||||||
$script_asset_path = plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.asset.php';
|
$script_asset_path = plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . 'admin/js/job-metabox.asset.php';
|
||||||
$script_asset = file_exists( $script_asset_path ) ? require( $script_asset_path ) : [ 'dependencies' => [], 'version' => filemtime( plugin_dir_path( QUIZTECH_PLUGIN_FILE ) . $script_path ) ];
|
$script_asset = file_exists( $script_asset_path ) ? require( $script_asset_path ) : [ 'dependencies' => [], 'version' => file_exists( $script_local_path ) ? filemtime( $script_local_path ) : QUIZTECH_VERSION ]; // Use filemtime with local path
|
||||||
|
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'quiztech-job-metabox-script',
|
'quiztech-job-metabox-script',
|
||||||
$script_path,
|
$script_url, // Use the URL here for enqueuing
|
||||||
array_merge( $script_asset['dependencies'], [ 'jquery' ] ), // Add jquery dependency
|
array_merge( $script_asset['dependencies'], [ 'jquery' ] ), // Add jquery dependency
|
||||||
$script_asset['version'],
|
$script_asset['version'],
|
||||||
true // Load in footer
|
true // Load in footer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue