Tagged Questions
0
votes
1answer
41 views
Stop a plugins js and css from loading on all pages and show up only where it is called
This plugin has an unique way of registering styles and scripts so I have no idea on how to stop it from loading on all my pages. After a quick search to see where wp_enqueue_style&script is I ...
0
votes
2answers
224 views
Failing to load my script files in wordpress! i can't figure out what i'm doing wrong
i have customized my .html as a custom wp theme.
i have these scripts in my header.php:
<script type='text/javascript' src="scripts/jquery-1.8.2.js"></script>
<script ...
0
votes
1answer
76 views
Move jQuery to the bottom of the page whilst keeping the WordPress jQuery
I wish to move jQuery to the bottom of the page on my theme, to speed up loading times.
Previously I was doing this by replacing it with Google's CDN version but I have been told that is a bad thing ...
0
votes
1answer
94 views
Register script/style: Is it possible to customize the version query string via plugin?
Expanding on the question in the title:
I would like to find a way (via a plugin) to use timestamps for the JS and CSS file version query strings that are output with wp_register_style and ...
3
votes
1answer
469 views
When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
I'm having trouble understanding when you need to use wp_register_script(). Currently, I just use something like:
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
function enqueue() ...
0
votes
2answers
75 views
If a Script has been enqueued but not registered can I still removed it?
There is a plugin that's conflicting with mine when the user loads the admin pages of my plugin, therefore I want to deregister and remove the conflicting script on these pages.
Here is the code for ...
0
votes
2answers
80 views
Trying to get custom js files in my admin header
I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my ...
1
vote
2answers
124 views
Adding scripts to admin page in my theme
In functions.php of my theme I have code to add page in admin area and append scripts to it. But scripts are not loaded. Bellow is code. Commented out add_action lines are the one I did check.
// ...
0
votes
1answer
356 views
How to Add a Custom Script to Customize.php
I am having a rather difficult time adding a script to the 3.4 Theme Customizer (i.e., customize.php). If I want, I can deregister jquery and add it from googleapi as follows:
wp_deregister_script( ...
0
votes
0answers
59 views
WP_register_script() - odd behavior or bug [closed]
I've got WordPress Theme and WordPress Plugin. Both use colorpicker.js file. Theme has this in functions.php (for admin only):
wp_register_script('jquery_colorpicker_script', ...
2
votes
1answer
67 views
Hyphens vs. periods in the script slug in wp_register_script?
I have seen script and style handles written in two different ways in wp_register_script and wp_enqueue_script (the same applies to wp_register_style and wp_enqueue_style):
wp_register_script( ...
0
votes
2answers
390 views
include jquery plugin file not working
My code for include js as follows:
function you_fancy_js(){
wp_register_script( 'custom-script', plugins_url( '/js/jquery.js', __FILE__ ), array( 'jquery', 'jquery-ui-1.8.18.custom.min', ...
5
votes
1answer
1k views
Register and enqueue conditional (browser-specific) javascript files?
The WP.SE community has always advised the use of wp_register_script and wp_enqueue_script for adding scripts in a theme/template (and likewise, wp_register_style and wp_enqueue_style for ...
1
vote
1answer
133 views
getting a js file for one page
wp_register_script('SliderViewer', '/js/SliderViewer-1.2.js');
wp_enqueue_script('SliderViewer');
get_header();
however, mydomain.com/js/SliderViewer-1.2.js doesn't exist.
My js is in the ftp at
...
0
votes
1answer
231 views
admin_enqueue_scripts not rending JS file correctly
I'll keep this short and sweet, I want to load a JS file in the admin panel as part of my plugin, and through tons of research I have a few different options that have all ended with the same problem ...
0
votes
1answer
142 views
Need help with adding jQuery script to WP and calling script to page
I've written a pretty simple jQuery script, and I don't know how to call it. It's in its own directory.
First, how do I register it, and then how do I enqueue it?
I assume that's the order it's done ...
0
votes
1answer
410 views
Deregister multiple scripts using a function?
I'm trying to deregsiter multiple scripts using the following function.
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
if ( ...
2
votes
1answer
390 views
enqueue and localize script in footer
I have a script which must run in my footer, after some variables are declared. It works if I just put the code directly in my footer file, but I think best practices dictate I should do this via ...
4
votes
1answer
493 views
Load js/css files only on specific admin UI pages
How do I adapt this solution to work with my plugin? (Please see the link).
I enqueue my css and js script as follows:
function my_plugin_init() {
wp_enqueue_script('my_plugin_script', ...
5
votes
1answer
1k views
wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i'm confused
I've been reading up a bit on this subject, but the more I read - the more confused I get.
Can someone explain to me in short what's the exact difference between wp_enqueue_scripts, ...
1
vote
1answer
183 views
Help with enqueing scripts in footer after init action
In my functions.php, I have set a register_scripts() and load_scripts(), and hooked them to the 'init' action.
I have registered all the scripts to be loaded in the footer, in order to optimize page ...
1
vote
2answers
509 views
Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
I've been playing with Modernizr in WordPress lately and here's something that i'm trying to achive.
I'm adding an HTML5 input field in a custom options page, specifically:
<input type="number" ...
1
vote
2answers
717 views
wp_enqueue_script vs. wp_register_script
Trying to do the right thing here, and tying myself in a knot! So, in my header.php before wp_admin, I have:
wp_enqueue_script('commonfunctions', child_template_directory . ...
18
votes
1answer
3k views
Where is the right place to register/enqueue scripts & styles
I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use:
to register and/or enqueue
scripts and styles
on front- and back-ends?
Questions:
Which are right hooks to ...
0
votes
2answers
1k views
How do I get a child theme to load scripts from the parent theme?
Pretty new to WordPress functions, so apologies if this is basic stuff.
I've designed a parent theme that registers and enqueues two scripts like so:
if ( !function_exists( 'scherzo_scripts' ) ) ...
11
votes
3answers
2k views
Check if a script/style was enqueued/registered
Is it possible to test whether a script or a style was registered using wp_register_script/_style or wp_enqueue_script/_style? All functions doesn't return a value and I'm completely clueless.
I ...