You’re registering/enqueueing your script wrong. You should register/enqueue in your theme’s functions.php
file instead of inside the header/page.
Also, you need to use your theme’s directory … which will be along the lines of mydomain.com/wp-content/themes/BLANK-Theme/js/SliderViewer-1.2.js
.
Use this code in functions.php
:
function my_scripts_enqueue_method() {
wp_enqueue_script(
'SliderViewer',
get_template_directory_uri() . '/js/SliderViewer-1.2.js'
);
}
add_action( 'wp_enqueue_scripts', 'my_scripts_enqueue_method' );
This will enqueue and register your script, and ensure that you’re using the appropriate directory for your theme in the process.
Related Posts:
- When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
- Check if a script/style was enqueued/registered
- How to properly dequeue scripts and styles in child theme?
- Cannot deregister a script using wp_deregister_script
- How to dequeue / deregister any theme styles and scripts
- Hyphens vs. periods in the script slug in wp_register_script?
- enqueue and localize script in footer
- How to Add a Custom Script to Customize.php
- wp_enqueue_script vs. wp_register_script
- Child Theme – what is the scope of overwriting files?
- Best way to enqueue extremely popular scripts like bootstrap and font awesome
- Best spot for wp_register_script() and wp_register_style()
- wp_enqueue_script with dependencies doesn’t work
- Register script/style: Is it possible to customize the version query string via plugin?
- Help with enqueing scripts in footer after init action
- Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
- How to cancel `wp_print_scripts`?
- Including style.css in Child Theme
- Can’t see why my scripts aren’t loading when I register and enqueue them
- Including files in Child Themes
- WordPress script file version numbers changing in live environment
- Change script type and src of plugins in theme
- How to enqueue JavaScript file that depends on CSS stylesheet
- Adding multiple wp_register_scripts for templates in WordPres?
- Localizing script to pass a value to a javascript function
- Enqueuing script is adding extra text for google maps [closed]
- Deregister multiple scripts using a function?
- wp_enqueue_scripts does not work
- Modular CSS and JS in Child Themes
- If a Script has been enqueued but not registered can I still removed it?
- include jquery plugin file not working
- How to use wp_register_script / wp_enqueue_script for multiple queries
- How to register script with null value for version?
- Using wp_enqueue_script on scripts that contain PHP
- Stop a plugins js and css from loading on all pages and show up only where it is called
- Enqueue registered dependencies only when necessary
- How to get, in WP page’s script, a wp enqueued script (in Functions.php)?
- wp_enqueue doesn’t load dependencies
- Why do WordPress adds the id=”handle-{js|css}” attribute to scripts and stylesheet?
- Dequeue/deregister scripts for everybody but the administrator
- wp enqueue inline script due to dependancies
- How to load css in the footer [duplicate]
- wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused
- Register and enqueue conditional (browser-specific) javascript files?
- Is it safe/recommended to use wp_enqueue_script function outside the functions.php file?
- wp_enqueue script my_javascript_file in the footer
- How to load JQuery easing script in wordpress?
- Hook for writing text string after footer scripts
- Issue with using Underscore in WordPress
- Track down where script is being enqueued from
- $wp_styles->registered not giving ALL the styles?
- Benefits to enqueuing site scripts/stylesheets?
- Adding Custom Javascript to Skeleton Child Theme
- Most elegant way to enqueue scripts in function.php with foreach loop
- Problem in wp_localize_script
- Enqueue scripts to a specific header-.php?
- Enqueued scripts and styles loading in WordPress Dashboard as well
- How can I load script and style in specific page in the back-end?
- Enqueue script with url_query variables?
- Using multiple versions of jQuery while still calling it like WP likes
- What are the advantages of using wp_enqueue_script()
- How do I get a child theme to load scripts from the parent theme?
- How do I enqueue a JavaScript in my footer via the functions.php file?
- wp_enqueue and Dependencies
- Why are files enqueued with wp_enqueue_style and wp_enqueue_script 404 Not Found?
- Deregistering a script in WordPress seems impossible
- Utilizing WordPress’ Admin UI for plugin settings: getting accordion style
- wp_enqueue_script Doesn’t Work?
- Getting wp_footer() to work without wp_head()
- Move scripts to footer, but exclude one script?
- Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?
- Is there a way to check for an attribute of a script when using script_loader_tag?
- wp_editor() youtube link does not load video
- How to force that styles are enqueued in the header?
- Enqueue customizer scripts that are bundled by webpack?
- Where is the right place to register/enqueue scripts & styles
- How do I get jQuery to Load before Bootstrap?
- Where to insert Google Maps API code in functions.php
- wp_enqueue_script was called incorrectly Issue when active plugins of WordPress Admin Bar Improved
- How to add conditionals for IE browsers between certain versions?
- call my script only after loading UI library?
- Loading Scripts For Specific Template
- why wp_enqueue_scripts() not working?
- scripts not loading
- FullCalendar in WordPress is not working
- Wp_deregister_script() doesn’t work
- enqueue_scripts() in child theme doesn’t work
- How do you load js and style resources from CDN with local fallback using wp_enqueue_scripts?
- wordpress enqueue script not working
- WordPress – enqueue js issue – page broken, no error
- Enqueue script with version number not working
- Set a parent script presence status true so that child scripts load in wordpress
- correct path for enqueue script in WordPress
- map enqueue in backend
- How to wp_enqueue_script with html?
- Most optimal way of starting fresh, without using other theme or dropping old files?
- Need help with adding jQuery script to WP and calling script to page
- Bootstrap css not getting applied to the custom WordPress Dashboard Widget
- WooCommerce not enqueuing its scripts [closed]
- See Scripts used by Page