Would you please try below code to your plugin page.
if the script file is your plugin root directory.
function plugin_adding_scripts() {
wp_register_script('my_test_script', plugins_url('testscript.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('my_test_script');
}
add_action( 'wp_enqueue_scripts', 'plugin_adding_scripts' );
Also: http://blog.aztora.com/add-css-js-into-wordpress-plugin/
Related Posts:
- Is it ever okay to include inline CSS in plugins?
- How to include jQuery and JavaScript files correctly?
- Load js/css files only on specific admin UI pages
- Get list of scripts / styles and show file which enqueued them
- jQuery in header or footer
- How to prevent loading of all plugin’s resources?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- Use js script from one plugin in another plugin
- Can’t get JS code to work with shortcode
- How do I add a javascript file to all admin pages via a plugin?
- Dequeue theme stylesheets but keep widget styling on custom page template
- Relative path instead of absolute for wp_enqueue_script
- is_page() function doesnt working
- how to include javascript file and css file in wordpress
- How to avoid loading same script twice?
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Where to call wp_enqueue_script in a plugin with custom template?
- How to insert html/css/javascript code to wordpress plugin
- CSS not affecting widget output
- How can I avoid conflicts between plugin and theme?
- should i be checking for jquery before enqueing it in a plugin
- My stylesheets are not enqueuing
- Plugin Development – Class Constructor Not Firing wp_enqueue_style action hook
- Enqueuing scripts and styles in custom plugins
- How to enqueue scripts in right way in a plugin?
- How to make my shortcode load scripts and styles, from within the plugin?
- enqueing Javascript and CSS
- Theme JS is available but theme CSS isn’t
- Enqueue a file that’s not js or css
- How to insert HTML/CSS/JS into my iframe plugin?
- Enqueue ONLY Plugin Styles and Scripts
- CSS not being applied using wp_enqueue_style
- WordPress Plugin Authoring question about jquery and css
- Is “document loaded” different on admin side than public side?
- plugin css is not being applied to the page
- How do I ensure I can loop through every enqueued script and CSS?
- Append php file to footer
- How to avoid conflict if a plugin already have included open library?
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Bootstrap 4 Optimization
- How to only Load scripts on variable products page
- how to add contact form 7 shortcode in javascript variable
- How to add a javascript snippet to the footer that requires jQuery
- How can I get a list of all enqueued scripts and styles?
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- How to load scripts/styles specific for a page
- Can I use the wp media uploader for my own plugin?
- Customizing the 3.5 “Add Media” popup (Backbone.js)
- Hook the Keydown Event in the TinyMCE Post Editor
- How can I dequeue a Plugin Stylesheet?
- Use wp_enqueue_scripts, not wp_print_styles?
- lodash dependency in a Gutenberg plugin
- What is the best way to provide plugin users with a way to customized the styles
- How do I only load js on the post-new.php and post.php pages in admin?
- creating elements/innerblocks via rangecontrol
- Move all the JS files to the bottom|footer, the right way
- Inserting JS snippet in the footer if there is no wp_footer?
- How to Load Plugin JS in theme’s footer section
- Custom Admin CSS styles to style media uploader?
- Gutenberg blocks not getting styled on back end
- Plugin CSS not enqueing
- conditionally load javascript & CSS for do_action() calls from plugin
- What stylesheets are available in core?
- Enqueue WordPress plugin scripts below all other JS
- How to integrate my HTML and javascript into my child theme
- Gutenberg: import dependency or assign from global variable?
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Enqueue script globally
- Can’t change the style of a submit input type? [closed]
- wp_localize_script is not adding a global variable for javascript
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- Distributing Frontend Assets with Plugins
- Run JavaScript validation script on form submit in plugin
- Are there any official or unofficial guidelines for the styling of a widget?
- How can I force Dynamic CSS via ACF values to update on page load?
- Insert Into Post Not Working For Audio File Using jQuery
- I want to set global directory locations for my CSS and JS locations. How?
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- Enqueue scripts inside a class in a plugin
- Dynamically add Js
- wp.media libary pdf type
- Advanced method to control cache of enqueued style/script
- Query String Filtering API
- Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?
- wordpress plugin add page when activate
- Add default value from selection
- Adding External Gmap JS to WordPress
- Load script on frontend from widget plugin
- AJAX call of function containing javascript which is not loaded (Plugin development)
- Filterable posts using categories
- Ajax Response Error | just getting error as the response
- Publish, Save Draft and Preview buttons do not work after being moved with jQuery
- Unable to link CSS file
- How can I add the Post ID to Class Name in Jquery?
- custom post with loading script per single post
- Best practice to include custom user styles in widgets
- Enqueue Script in custom plugin before other
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Insert meta-description into Yoast-SEO input-field via JavaScript
- Reinitiate Gutenburg’s blocks using javascript