Skip to content

Commit bdcd675

Browse files
committed
admin-viewer file paths edited
1 parent feeee81 commit bdcd675

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

yunus_admin_viewer_plugin.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,32 @@
1313

1414
// Enqueue scripts and styles conditionally
1515
function yunus_admin_view_enqueue_scripts($hook_suffix) {
16-
// Load only on the custom admin page
1716
if ($hook_suffix === 'toplevel_page_yunus-admin-view-app') {
1817
wp_enqueue_script(
1918
'yunus_vue_app',
2019
plugins_url('/dist/main.js', __FILE__),
21-
[], // Add script dependencies here if any, like 'jquery'
22-
filemtime(plugin_dir_path(__FILE__) . '/dist/main.js'), // Cache-busting
23-
true // Load in footer
20+
[],
21+
filemtime(plugin_dir_path(__FILE__) . 'dist/main.js'),
22+
true
2423
);
25-
24+
2625
wp_localize_script('yunus_vue_app', 'yunusPluginData', [
2726
'root_url' => esc_url_raw(rest_url()),
2827
'nonce' => wp_create_nonce('wp_rest')
2928
]);
30-
31-
wp_enqueue_style(
32-
'yunus_vue_styles',
33-
plugins_url('/dist/style.css', __FILE__),
34-
[],
35-
filemtime(plugin_dir_path(__FILE__) . '/dist/style.css') // Cache-busting
36-
);
29+
30+
// Check for style.css before enqueueing
31+
$style_path = plugin_dir_path(__FILE__) . 'dist/style.css';
32+
if (file_exists($style_path)) {
33+
wp_enqueue_style(
34+
'yunus_vue_styles',
35+
plugins_url('/dist/style.css', __FILE__),
36+
[],
37+
filemtime($style_path)
38+
);
39+
} else {
40+
error_log('Style.css file not found at ' . $style_path);
41+
}
3742
}
3843
}
3944
add_action('admin_enqueue_scripts', 'yunus_admin_view_enqueue_scripts');

0 commit comments

Comments
 (0)