Tag Info

New answers tagged

0

It's hard to tell what's going on with your enqueue scripts but that's probably the most preferred way. A secondary option would to add it directly to your header.php file: <head> <script src="<?php echo get_template_directory_uri(); ?>/js/html2canvas.js"></script> <script src="<?php echo get_template_directory_uri(); ...


2

You need to delay the firing of your code, otherwise your conditionals will evaluate false (the request won't have been parsed yet). Use the action wp_enqueue_scripts: function wpse_182357_enqueue_scripts() { // Your code } add_action( 'wp_enqueue_scripts', 'wpse_182357_enqueue_scripts' ); Update: Missed the root of the problem - is_page_template() ...


0

If you enqueue a script to the header but declare a dependency to a script enqueued to the footer, WordPress will move the footer script to the header to make it available to the dependent script/s.


1

You do not show how you hook your wp_enqueue_script() call. But the error message you get is pretty clear, use one of the following hooks: wp_enqueue_scripts admin_enqueue_scripts login_enqueue_scripts depending on the use case - see the notes at the wp_enqueue_script() codex page for additional information. For example do for correctly ...


0

CDNs, remote resources and cross origin requests You might want to replace the http: for your CDNs first. It could be that there are cross origin request problems when using that. Omitting the protocol allows the browser to chose the right protocol depending on the situation. The fixed protocol often is a problem in Chrome - the "overprotective parent". ...


0

Try: wp_enqueue_script( 'nevermind-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery') ); It is possible that jQuery is not enqueued, and you are not declaring it as a dependency for your script. Being logged in, automatically enqueues jQuery. EDIT: Console log says jQuery is not defined. Did you add a ...


1

I think you are missing the point here about dependency. If the dependency parameter has been set when registering or enqueueing a style or script, that style or script will wait in queue for the style or script it is dependent on to load. This particular script or style will not load until the script or style it is dependant on is fully loaded. Now, if you ...


0

Please make sure you are utilizing wp_head() and wp_footer() functions at appropriate places in your theme?


0

We need to wp_enqueue_script the script and wp_enqueue_style the style with add_action to the functions.php file. Just include a jQuery file and stylesheet file by this script. // Register Scripts &amp; Styles in Admin panel function custom_color_picker_scripts() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'iris', admin_url( ...


0

The simple answer is, "No". Although admin_enqueue_scripts and wp_enqueue_scripts hooks does exactly the same thing, the do their work in separate places which do not have any reference to the other. wp_enqueue_scripts runs on the public side or front end admin_enqueue_scripts As the name suggests, it runs on the admin side or back end Your script that ...


2

Straight outta the Codex: wp_enqueue_scripts is the proper hook to use when enqueuing items that are meant to appear on the front end. Despite the name, it is used for enqueuing both scripts and styles. So the simple answer to your question is yes, wp_enqueue_scripts is always the correct action for enqueuing scripts AND styles. This is so other ...


0

This is old but for anyone else reading this question, don't use github as it won't work. <?php /** * Plugin Name: Add JQuery Chosen Quickly * Plugin URI: http://wordpress.stackexchange.com/questions/85824/ * Description: Test/Add chosen to site without adding any files * Version: 1.0 */ function enqueue_chosen_jquery() { wp_register_style( ...



Top 50 recent answers are included