Tag Info

New answers tagged

2

To print JavaScript code to your page, you have several paths to choose from. The most obvious would be the wp_footer action. Just hook a function to it and make it print your JavaScript/jQuery code, wrapped in <script /> tags. // EDIT As an addition, if your custom JavaScript/jquery code is static (i.e., there are no dynamic parts in it), you should ...


0

You can't directly use sendTrailer.php ,wordpress can't find this custom page directly so you have to specify fully path of that page using get_template_directory() In your ajax function write url : '<?php echo get_template_directory(); ?>/sendTrailer.php'


1

The primary reason we use enqueue scrips is because WordPress will properly manage all the requests. For example, if two different plugins are using a certain third party library, WordPress will make sure that the script is only loaded once. It will also do a good job of handeling multiple version of the same script. Lastly, you will also be able to ...


0

Added this code to updated the selected field by identifying the appropriate value in the taxonomy column: jQuery(document).ready(function($) { // Create a copy of the WP inline edit post function var $wp_inline_edit = inlineEditPost.edit; // Overwrite the function with our own code inlineEditPost.edit = function( id ) { // Call the original ...


0

WordPress's wp_register_script has an $in_footer parameter which allows you to state if the script should be written to wp_head or wp_footer. By default the value is false (don't show in footer), but you could try it yourself. Replace your wp_register_script with this: wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/'. $jquery_ver ...


-1

In wordpress exists wp_is_mobile() function.This may help you. You must see how is named cufon handle in plugin if(wp_is_mobile()){ wp_dequeue_script( 'cufon_handle' ); }


0

The action should be part of the data object: var formdata = new FormData(); formdata.append('name', 'This is Name'); formdata.append('action', 'plugin_save'); $.ajax({ url: 'admin-ajax.php', type: 'POST', data: formdata, contentType:false, processData:false, success: success, error: error });


0

Here's a quick example showing how you would pass php data to your script. First, we hook our function to the wp_enqueue_scripts action. Inside, we enqueue the script that contains the player and initialization code (this is probably two separate files, but I've condensed it to a single file in this example). Next, we call wp_localize_script and set some ...


1

The hooks are fine for change the login style. I think is better idea to identifier, why is the load so much slow. I have a lot of change for different installs and no problems with this hooks. But I see also often a lot of loads of unused source. I change the login style with this class: ...


1

As @aaron-holbrook commented a cleaner approach will be to do: <script> $(document).on('widget-updated widget-added', function(){ // your code to run }); </script> Just pasting here for reference as answers are much easier to find that comments


0

I don't have enough reputation to reply to comment on your answer, so I will post it here: I had similar problem, and answer why class selector works (and id don't) is because on widgets page, that element appears twice (on left side to select it and drag to the right), and on the right side, in appropriate sidebar area. So, that element and everything in it ...



Top 50 recent answers are included