Links a script file to the generated page at the right time according to the script dependencies, if the script has not been already included and if all the dependencies have been registered. You could either link a script with a handle previously registered using the wp_register_script() function, ...

learn more… | top users | synonyms

-1
votes
0answers
7 views

Google Maps InfoWindow and Chat Plugin Wise Chat [on hold]

In my Wordpress Page, I embed a Google Map. An InfoWindow is opened when a user clicks on The Marker. I have customized the InfoWindow to display do_shortcode( '[wise-chat]'), which is a shortcode ...
0
votes
1answer
13 views

jQuery plugin not loading

I am trying to use the below function to enquue 2 scripts (one internal, one external). The internal one ('custom_script') is working, but the 2nd one ('formValidation') isn't (I get a 'validate() is ...
0
votes
2answers
42 views

How can I get a list of all enqueued scripts and styles?

I'm creating a plugin and I want to get the list of all scripts and CSS used by other plugins. This is my function: function crunchify_print_scripts_styles() { $result = []; $result['...
-4
votes
1answer
19 views

Using Headroom.js with Bootstrap4 in Wordpress

So I'm trying to work on a site on my localhost here and I cant figure out why this won't work in Wordpress. I'm not sure if it's the way the scripts being declared or what as I've got a perfect ...
1
vote
1answer
24 views

Script Localization doesn't work

I don't get how script localization works in wordpress. I created an associative array in php: $translations = array( 'value1' =>'This is first value', 'value2' =>'This is second ...
0
votes
0answers
10 views

Comment Reply not loading

The nested comments feature is enable in my settings and I have the following block of code inside my functions.php function my_scripts() { wp_enqueue_script( 'main', get_template_directory_uri()...
0
votes
1answer
17 views

Enqueue scripts in footer

I'm trying to build a plugin and enqueue my scripts to footer. For performance reasons I'd like to load this plugin scripts after the functions.php scripts, because furthermore it will break the page ...
0
votes
0answers
32 views

How to include a plugin's (MailPoet) javascripts using child theme's functions.php

I have to include some javasripts files in all pages of my website. They are required by MailPoet to handle newsletter subscriptions. Now, I may add them directly into the head section, but I'd like ...
0
votes
1answer
23 views

WordPress wp_enqueue_script only adds text to top of page source

All I'm trying to do is add some javascript to a WordPress theme I'm making. My functions.php file looks like this: function my_scripts() { wp_enqueue_script( 'jquery' ); wp_register_script(...
-1
votes
2answers
38 views

javascript not loading in wordpress

I originally posted this in the stackoverflow, but I believe it is better posted here as I am using wordpress and a wordpress function. I am trying to add the jquery cycle plugin (http://jquery....
0
votes
1answer
34 views

Proper use of wp_localize_script?

I want to pass an array of data to my script mygaloochart_script located in the chart.js file. Here's what I tried: //I'm no using $atts directly because of reasons $dataToBePassed = array ( ...
0
votes
2answers
32 views

My stylesheets are not enqueuing

I'm in Wordpress 4.5.2 on Windows 10 and I'm trying to register and enqueue my stylesheet in Wordpress, but it just isn't working. I'm having the same problem with jQuery. I have this code in a ...
0
votes
0answers
54 views

wp_enqueue_script and wp_enqueue_style doesn't load content over https

I have a problem with serving scripts and styles over https. Scripts included via functions.php and used proper get_stylesheet_directory_uri(), here's some code: add_action( 'wp_enqueue_scripts', '...
0
votes
1answer
40 views

wp_enqueue wont work on some files?

So if i use the following in functions.php in the root off my child folder it works as supposed: add_action( 'wp_enqueue_scripts', 'register_my_scripts'); add_action( 'wp_enqueue_scripts', '...
-1
votes
3answers
120 views

Enqueue scripts based on browser width?

Is it possible to load scripts through wp_enqueue_script based on a browser's width? Thanks
0
votes
1answer
62 views

Wordpress Jquery+scripts enqueue issue

I'm having some issues in loading a custom jquery slider into a wordpress site I'm working on: I'm not super proficient with theme development but I'm studying hard and I spent lots of days trying ...
0
votes
1answer
38 views

Getting a variable inside foreach from PHP to JS after localization

I believe I have properly enqueue'ed and localized my script - I've got $q showing up in the DOM. Now I'm sure I'm missing the simple last step to accessing a variable in the JS function. Here's my ...
0
votes
0answers
9 views

Add a “NEW” banner to bottom of every new post [duplicate]

I'm working on http://juniorgoldreport.com The owner wanted a "new" banner tag on new post's, so to make it easy I was going to put it on the images, but because of scaling and different images it's ...
0
votes
2answers
52 views

enqueue script on custom post type archive page

How do I enqueue a script on the header if the user is on an archive page of a custom post type? The custom post type is called limitedrun and the page is called archive-limitedrun.php. I tried this ...
1
vote
1answer
48 views

How to To Filter wp_enqueue_script() Scripts on Some Pages

I am using following code to add some scripts in WP pages like function add_js() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "")...
0
votes
2answers
21 views

link to JS library using wp_enqueue_scripts not working

I've added the following code to functions.php of my activated child theme: function fullpagejs() { $slimscroll = get_stylesheet_directory_uri() . '/library/fullPage.js-master/vendors/jquery....
2
votes
0answers
15 views

Script won't execute in the media manager

I'm trying to execute a jquery script on the click of a button in a custom tab of the media manager, but it does not seem to work. I have been told this might be due to the button not being loaded ...
4
votes
2answers
372 views

Get php var inside javascript file (making plugin)

I was making a plugin and I have a javascript file where I want to take some options saved in the database to show well the function. So I have this: function wp_home(){ wp_enqueue_script( '...
0
votes
2answers
26 views

Custom script file enqueue has “?ver=4.5.1” when loading and doesn't update

I'm loading a custom script file using an enqueue and here's the output: <script type='text/javascript' src='.../wp-content/themes/enfold-child/js/custom_script.js?ver=4.5.1'></script> ...
0
votes
2answers
53 views

Overwrite wp_enqueue_script under certain condition

I have an enqueued script called custom_js that loads the file js/custom.js. I want the file to change when a certain condition is true, but it does not seem to work. Here is my code: add_action('...
0
votes
1answer
56 views

Enque Typekit Fonts - Not Found

I'm trying to enqueue a typekit on my WP site in a function using code below: /** * TypeKit Fonts * * @since Theme 1.0 */ function theme_typekit() { wp_enqueue_script( 'theme_typekit', '//use....
1
vote
1answer
55 views

wp_enqueue_media() Will not load JS on the theme

I've added wp_enqueue_media() to a specific page (before including the header) on my custom theme but it flat out will not any of the JS on the page. I've already done the basic troubleshooting: ...
0
votes
1answer
95 views

is_page_template & is_page in functions.php not working

I use the following script to call the maps JavaScript in the page-about.php template. But its actually not working. The scripts are executed nowhere: // Load maps scripts function maps_scripts() { ...
0
votes
1answer
21 views

add_action wp_enqueue_script priority level only works for admins

I have a function in my functions.php file that loads all of the scripts into the header for my website. The line to run the function was like this: add_action('wp_enqueue_scripts', '...
0
votes
0answers
70 views

jQuery is not defined in wordpress

Got the not defined error for the script below : JQuery.noConflict(); jQuery(document).ready(function($) { /** Code using $ referencing to jQuery **/ }); Can't explain why and solve the problem,...
1
vote
1answer
27 views

Calling JavaScript file with Custom Plug In

So, the goal is to use jQuery Validation for a custom form. Maybe I'm going about this the hard way. But, here's what I'm doing: Uploaded the jQuery Validation file to my theme folder Created plug-...
0
votes
0answers
30 views

wp_enqueue_scripts doesn't work for template pages

In my child theme's functions.php I wrote : function add_js() { echo "path is : ".get_stylesheet_directory_uri().'/js/script.js'; wp_enqueue_script( 'script', get_stylesheet_directory_uri().'/...
0
votes
1answer
31 views

I can't enqueue Suggest.js in frontend - not added

my suggest.js is not being added in front-end. All scripts are correctly loaded but this one. I want to load it only on frontpage so: add_action('wp_enqueue_scripts', 'homescripts'); function ...
0
votes
1answer
53 views

If is multiple page templates

Via functions.php, I'm trying to enqueue specific scripts and styles based on two separate page templates. Here's what I've tried: if ( !is_page_template('page-templates/page-index.php') && !...
0
votes
1answer
86 views

linking stylesheets and scripts with functions.php

I am following along with this tutorial. I am trying to link the javascript and css files that are usually linked in the header using wp_enqueue_scripts in functions.php. With what I have now, only a ...
0
votes
1answer
35 views

javascript file is not enqueing

I'm working on a custom wordpress theme. The js file is in wp-content/theme/custom-theme/js/bootstrap.min.js. I'm not able to load this on page while I can load the custom CSS file. My code is: ...
0
votes
1answer
56 views

How to dequeue / deregister parent theme style

I'm making a child theme, and I'd like to remove the Google font style that it calls for in 'fonts-style' function nada_theme_styles() { wp_register_style( 'fonts-style', '//fonts.googleapis.com/...
0
votes
2answers
165 views

Enqueue Javascript After ALL Other Scripts (Including Async Scripts)

I have a script I'd like to include with Wordpress. This script relies on another (prettyPhoto) to run, as well as on JQuery being loaded. I'd like my script to be the very last script to be included ...
1
vote
1answer
90 views

wp_enqueue_scripts not working inside shortcode

<?php class OrdersShortcode { function __construct() { add_shortcode('order_ajax_form', array(&$this, 'order_ajax_form')); } function my_enqueued_assets() { ...
4
votes
3answers
909 views

Remove extra Google Maps script

I'm developing a plugin that use a Google Maps API. The plugin enqueuing script in this way: wp_enqueue_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false&callback=initialize&...
0
votes
1answer
88 views

Different body image backgrounds on different pages, posts and categories

I am trying to implement the ability to choose a different body background image to different posts, pages and categories. I am using Advanced Custom Fields to add an image field to every post, page ...
0
votes
1answer
39 views

get_stylesheet_directory() in child theme breaks parent scripts

I tried hard finding another question that may answer my query but failed, so if you point any duplicates that would help. Here is my situation I have a parent theme and I am developing a child ...
0
votes
2answers
43 views

Where to enqueue stylesheets for plugin?

I want to enqueue stylesheet to plugin I'm developing, like this: function utm_user_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_enqueue_style( 'style', $plugin_url . "/css/style....
1
vote
1answer
120 views

wp_enqueue_script with dependencies doesn't work

I'm having this code: wp_register_script('parent','parent.js', array('child'), '1', true); wp_register_script('child', 'child.js', array('grandchild'), '1', true); wp_register_script('grandchild', '...
-2
votes
2answers
125 views

comment-reply.js is not loading

I'm building my own website within WordPress from scratch. It's not really a new theme, just everything from the beginning, starting with an index file, header, footer, single, comments, functions etc....
0
votes
1answer
221 views

Chosen Select jquery Not Working in Plugin

For some reason js and css files are not loading in my plugin. Here's what I have: (ostensibly unrelated code replaced with '...') class Location_Specific_Menu_Items { private static $instance = ...
1
vote
3answers
132 views

Loading scripts with wp_register_script and wp_enqueue_script

How could I include the following script and stylesheet in a wordpress plugin if they only need to load in the admin panel? <script type="text/javascript" src="/wp-includes/js/jquery/jquery.js?ver=...
2
votes
0answers
55 views

iris color picker in widget - click event doesn't fire when initially when widget is first created

I added the wordpress(iris) color picker to a widget, and the color picker is not clickable when the widget is first created. My guess is that it's where/how the javascript file is being enqueued, but ...
1
vote
1answer
37 views

How to load an assets based on custom field value?

How can I load an asset based on custom field value? - This would be outside of the loop, all I can find for this is in the loop related functions, which I'm not familiar with, or what I find are ...
0
votes
1answer
41 views

How to add conditionals for IE browsers between certain versions?

I know that wp_script_add_data and wp_style_add_data are the correct functions for adding IE conditionals. For example, this: wp_script_add_data( 'foo', 'conditional', 'lt IE 9' ); Would get you ...