Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6035

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, or provide this function with all the parameters necessary to link a script. This is the recommended method of linking JavaScript to a WordPress generated page.

2 votes
1 answer
238 views

Adding Scripts in the Admin Area

I'd like to enqueue scripts only for an admin page that I've created. There's an example of this here: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_scripts_only_on_plugin_pa …
chrisguitarguy's user avatar
8 votes

Why is jquery-ui-core enqueueing in my footer instead of the header?

Why do you need it in the header? It's enqueuing in the footer because when it was registered it was set to enqueue in the footer. In wp-includes/script-loader.php: $scripts->add( 'jquery-ui-core' …
chrisguitarguy's user avatar
1 vote

Dynamic wp_enqueue_scripts?

You could use anonymous functions in PHP 5.3+ to do this. <?php function addThemeJS($enqueueThemeJS, $handle, $src, $deps, $ver, $in_footer) { add_action('wp_enqueue_scripts', function() use ($ha …
chrisguitarguy's user avatar
2 votes
Accepted

If a Script has been enqueued but not registered can I still removed it?

Yep, it's possible, but you want to use wp_dequeue_script. Try this: <?php function admin_hc_deregister_conflicts() { wp_dequeue_script('script_name'); }
chrisguitarguy's user avatar
18 votes
Accepted

How can I remove the site URL from enqueued scripts and styles?

Similar to Wyck's answer, but using str_replace instead of regex. script_loader_src and style_loader_src are the hooks you want. <?php add_filter( 'script_loader_src', 'wpse47206_src' ); add_filter( ' …
chrisguitarguy's user avatar
60 votes
Accepted

How to override JavaScript files in child theme?

Child themes only override php files (like header.php) that are included with functions like get_template_part or get_header, etc. The correct way to add scripts to WordPress is with wp_enqueue_scrip …
chrisguitarguy's user avatar
2 votes

How to enque js script in footer that are not in .js file?

You can just hook into wp_footer and print out your script. <?php add_action('wp_footer', 'wpse64534_script'); function wpse64534_script() { ?> <script> $(function(){ $('# …
chrisguitarguy's user avatar
3 votes
Accepted

Trying to add script to specific admin page is not working

I think you're using the wrong approach. Rather than removing the submenu item, alter how the post type was registered, and change the show_in_menu argument. Hook into init way late and change the arg …
chrisguitarguy's user avatar
1 vote

wp_enqueue_script() not working

The social network button you posted comes in two distinct parts. First, the button itself is defined by the anchor tag. <a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" …
chrisguitarguy's user avatar