Trying to include a js file in my plugin
-
Hi,
I am creating a plugin where I need to include a js file in the admin page of my plugin. The structure of the plugin is as follows:
admin (folder)
public (folder)
includes (folder)
languages (folder)
src (folder)
myplugin.php (main plugin file)What I am trying to Accomplish:
Inside the src folder is a .js file named bundle.js which I need to include in the file myplugin.php.
Current code being used which does not work to include the file:
<script src="dist/bundle.js"></script>
I know that I need to use code similar to the code below that is used to include an image but I am not sure how to do it for a .js file:
<?php echo '<img src="' . esc_url( plugins_url( '/myplugin/assets/logo.png', ) ) . '"> '; ?>
Any help would be greatly appreciated!
Thank you!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trying to include a js file in my plugin’ is closed to new replies.