0
votes
2answers
39 views

deregister scripts on certain page

i need to exclude certain scripts from running on a certain page. i have tried this code but it's not working - when i inspect the page the scripts are still being loaded into the footer of my page. ...
0
votes
1answer
28 views

Execute only on a certain page

I"m trying to get the block of code below to load only when it's the contact page but it doesn't seem to wotk. Any ideas what the problem could be. Still pretty much new to PHP. if ...
0
votes
1answer
47 views

Call two different function.js depending on page

I'm trying to find how I can call 2 different function.js depending of the page. When on "home", I want to load "function_2.js", and on the other pages of my website the original "function.js". I ...
0
votes
0answers
45 views

Exclude javascript in certain page url and all following url's after forward slash

I'm trying to exclude javascript from a couple of pages. But I want to target all the pages after the forward slash. So I want to to target: www.website.com/page-name/.. So the page-name itself, ...
0
votes
0answers
3k views

java script error Uncaught SyntaxError: Unexpected token ILLEGAL

i had a website that was working fine on localhost without any errors but after i uploaded it on the domain the slider stoped working and i got this errors Uncaught SyntaxError: Unexpected token ...
0
votes
2answers
107 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
1
vote
2answers
48 views

When using wp_enqueue_script(); in a theme why don't we use add_action?

When using wp_enqueue_script in a plugin, I have always been told to use an add_action : function add_my_css_and_my_js_files(){ wp_enqueue_script('jquery-validate-min', ...
0
votes
1answer
78 views

Enqueueing a code block from an options framework

I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global ...
0
votes
2answers
107 views

Why I can't load my JavaScripts using an hook inside my functions.php file?

I am pretty new in WP (I came from Joomla) and I have the following problem: I am carrying this pure HTML theme (that use BootStrap CSS framework) into a WordPress theme. This is the original pure ...
0
votes
1answer
138 views

Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?

My site's url is set up to include www in settings -> general. I also put it at the very top of my functions.php: update_option('siteurl','http://www.federal-lawyer.com'); ...
1
vote
1answer
34 views

Not sure if enqueuing js scripts properly

When I put this code right above the closing of my body tag it works, but when I try to enqueue it, it breaks. I'm thinking maybe jQuery isn't getting called? The snippet is from here FUNCTIONS.PHP ...
0
votes
2answers
993 views

jQuery code not working when included in functions.php

I feel like I am definitely missing something simple here... but for the life of me, can't find what I'm missing. I am of the "bad habit" of including jQuery functions directly in the header.php file ...
0
votes
0answers
48 views

using enqueue_script in a shortcode isn't working

I'm new to wordpress and I'm trying to get this to work by following the wordpress codex but I feel like I must be missing something obvious. I have a child theme based off of a parent one, and I ...
0
votes
1answer
248 views

In jquery use php variable to execute an enqueued jquery file

I am loading some jquery on a specific Wordpress admin page, the jquery loads and works fine but I need have this jquery only trigger if a php variable exists. In php I would just write a function ...
0
votes
0answers
56 views

Using array page name together with page id to deregister script

If I use this: if (is_page(array(blabla-test-page, 20726, 20720, 38881))) {wp_deregister_script( 'gdsr_script' ); } the blabla-test-page looks like it overrides different pages, even if certain ...
0
votes
1answer
518 views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
1answer
165 views

enqueue script if page is not equal to

I'm registering some js scripts in my function.php, I have 2 versions of one js file, one FOR the homepage, and one for every other page. I've managed to get this to work to register the homepage ...
0
votes
1answer
82 views

Enqueueing scripts selectively & activation where needed

If I enqueue my scripts selectively, for instance I have a slider I only want to load on homepage, which is activated in main-js, e.g: wp_enqueue_script( 'main-js' ); if ( is_front_page() ) { ...
0
votes
1answer
79 views

Why is this function crashing my wordpress installation? [closed]

I'm new to wordpress and programming in general. For my first site there is a custom template in which I want to load a javascript library. After registering and enqueueing it in functions.php my site ...
1
vote
2answers
179 views

Register and load scripts

In my functions.php function load_scripts() { wp_enqueue_script( 'jquery' ); wp_register_script( 'modernizr', get_template_directory_uri() .'/js/modernizr.foundation.js' ); ...
0
votes
1answer
178 views

colorbox not loading in <head>

I can not get colorbox fully loaded. I am trying to add color box to use in my plugin admin. I do not need it for the front end. I can get the css but can not get jquery.colorbox-min.js or the ...
0
votes
1answer
345 views

Fatal error: allowed memory size when after using enqueue_script

I an trying to enqueue four script files and keep getting this error: Fatal error: Allowed memory size of 103809024 bytes exhausted ... wp-includes/class.wp-dependencies.php on line 175. I used ...
1
vote
2answers
194 views

Avoiding Duplicate function names in Post Loop (WP_Footer script)

Say I created a plugin that injects content (used as a shortcode) into a post. I'm trying to push that code for each post to the bottom of the page. This works fine, however when you are on an ...
0
votes
1answer
334 views

wp_enqueue_scripts called twice?

I had some problem with WP recognizing a is_single condition for loading scripts called in function.php. I put a error_log(is_single()) to check what was going on. When opening a post page the log ...
2
votes
1answer
1k views

Problem using is_single() to enqueue script from functions.php

I'm having trouble only adding scripts to single post pages. I need to both include and exclude certain scripts using is_single() but it doesn't work either way I try it. I have the template tag on ...
3
votes
2answers
2k views

wp_register_script not loading as expected

I am loading scripts like this: //load scripts //wp_register_script( $handle, $src, $deps, $ver, $in_footer ); add_action('wp_enqueue_scripts', 'load_scripts'); function load_scripts() { if ...
0
votes
1answer
664 views

Enqueue script on every page except one

I want to load my javascript and exclude 1 page, so I tried the following without success: function mypage_scripts() { if ( !is_admin() ) { wp_deregister_script('jquery'); ...
0
votes
1answer
122 views

Why does this fail: Disabling plugins enqueue_script() in functions.php

I'm trying to use the method presented here: Restricting a Plugin to Only Load its CSS and JS on Selected Pages? In the plugin 'syntax-highlighter-compress' I've got the following code: function ...
2
votes
1answer
700 views

Enqueuing Script in functions.php vs on the page

Does it matter if I enqueue a script on just the page I need it to be used? As opposed to functions.php? Or, what is the best practice? In this example I need a rotator just on the front page of my ...
0
votes
1answer
1k views

wp_enqueue_script() not working

I'm trying to add this social-network button: <a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" data-type="compact" id="svejo-button">Add in Svejo</a> ...
2
votes
1answer
2k views

Wordpress Enqueue for homepage only, functions.php, wp-framework

I'd like to replace my: if(is_home()) { wp_enqueue_script( 'homestuff', get_theme_part( THEME_JS . '/home.js' ), array( 'jquery' ), null, true ); wp_enqueue_script( ...
0
votes
2answers
2k 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' ) ) ...
0
votes
1answer
476 views

Run a jquery script on on a certain template page

All I want to do is basically this: wp_register_script( 'jquery_zebra', get_bloginfo('stylesheet_directory') . '/library/scripts/jquery.zebra.js', array('jquery')); wp_register_style( ...
2
votes
3answers
546 views

wp_enqueue_script + how to load JS or CSS in one URL merge call?

Is there any proper wordpress way of including the JS and CSS through one merged URL? So that instead of loading in x number of separate calls for each JS asset, it can be all merged into one URL? ...