Tag Info

New answers tagged

-1

To answer this question, it is more about how you call jQuery rather than how you call the function. I have just changed my direct link to jQuery to the following: if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', ...


0

So, after hours of searching, I finally found where was my problem : another method in my class interfered with my ajax authentication system.


1

I prefer this: (function($){ "use strict"; $(document).ready(function(){ $('.flexslider').flexslider({ slideshow: true, animationSpeed: 400, initDelay: 100, animation: "slide", animationLoop: true, itemWidth: 258, itemMargin: 26 }); }); })(this.jQuery);


0

To make jQuery work in noconflict mode you need to wrap all the functions in your js-file like this: jQuery(window).ready(function( $ ) { Your functions here }); You can now use the $ selector as usual: $(window).load(function(){ Stuff here }); or $(document).ready(function(){ Stuff here }); I usually use the former, because document.ready sometimes ...


2

One way to do it (which is probably evil) is to select the control by adding a block of javascript using the tr field of $form_fields: function set_image_data( $form_fields, $post ) { $form_fields['text_color'] = array( 'label' => 'Text Color', 'input' => 'text', 'value' => get_post_meta( $post->ID, '_text_color', ...


1

Both DataTables Editor and WordPress are trying to use the same reserved parameter, 'action'. WordPress is using $_REQUEST['action'] to route the request in admin-ajax.php line 86. DataTables Editor is using $_POST['action'] to tell the server-side processing script what action to apply ( insert / delete / update - see: ...


1

As per comments try collecting the ids in an array and then setting the text field once: custom_uploader.on('select', function() { var selection = custom_uploader.state().get('selection'); var ids = selection.map( function (attachment) { return attachment.id; }); ...


1

The form reloads itself each time you save returning to the initial state where all are shown. What you can do is this: // Getting the value of the selected field var my_select_value = $('#widgets-right select.my-select').val(); // If there's no value selected, hide everything. if(my_select_value == 0){ $('.widget-test .row').hide(); } // Otherwise, ...


1

jQuery and the jQuery UI Slider are both registered by default by WordPress. In order to use them, all you should need to do is something like this: add_action( 'wp_enqueue_scripts', 'wpse192997_load_slider' ); function wpse192997_load_slider() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui-slider' ); } Note, though, that WordPress ...


0

Not necessary, you echo the value on the traitement page, and in your ajax request, you get put the echo in a variable, like : resultats = ajax.responseText;


0

Replace $( ".director", '.column-director' ) by $( ".director, .column-director") and also replace $ by jQuery


0

Try this jQuery code. jQuery('#your-button-id').click(function(){ jQuery(this).hide(); });


-1

As toscho pointed out, use jQuery(document).ready(function($) { ... }); instead of $( function() { ... }); Edit: Main problem is WP rich text editor escaping your html <script> tags. See https://codex.wordpress.org/Using_Javascript at the bottom of the page for a plugin-based workaround to turn off formating for specific posts/pages, allowing you to ...


0

In your ajax call, Just echo $results; Then do die(); Eg: echo $results; die();


1

Please find the code its working you need to just add the js and css for your design it will add three custom post and add widget to the widget area you can drag and drop it in any side bar. <?php /** * Plugin Name: Custom Tabbed Plugin * Description: This is testing of the custom tabbed plugin * Version: 1.0.2 * Author: ...


0

If you want to be able to validate server side the easiest option is to use Advanced Custom Fields to define your custom field layouts, and then the Validated Field add-on to set your validation per field in the WordPress Admin.


3

Have you tried returning an array instead? wp_send_json($an_array_of_your_vals); And then parse the array in the success function? success: function( data ) { var obj = jQuery.parseJSON(data); if( obj.arg_1 ) { $('selector').append( obj.content ); } else if( obj.arg_2 ) { $('other_selector').append( obj.content ); } ...


0

Please copy the woo-commerce checkout.js and paste in your theme folder and add following code in your function.php and after then you can change the checkout.js from your them. function so_27023433_disable_checkout_script(){ wp_dequeue_script( 'wc-checkout' ); wp_enqueue_script('checkout', get_template_directory_uri() . '/js/checkout.js', ...


0

Just use this code for media uploader . you got link in jquery response. <label for="upload_image"> <input id="upload_image" type="text" size="36" name="ad_image" value="http://" /> <input id="upload_image_button" class="button" type="button" value="Upload Image" /> <br />Enter a URL or upload an image </label> ...


2

I did similar thing recently but used the wp.media instead of ThickBox https://codex.wordpress.org/Javascript_Reference/wp.media with the same code from Codex. The only thing to make it work with multiple inputs is to move the frame variable from global scope to click function, so the 'frame' will be fresh for each click.


0

Thanks to @websupporter I managed to find a solution to my problem. I have used this inside my Ajax function: success: function(data){ jQuery(data).find('.message').appendTo('#login-error'); } And in the php code I have done this: ... if(empty($username)) { echo "<span class='message error'>Please enter username.</span>"; exit(); ...


0

How can I show these errors inside the Ajax success or error functions? The jQuery error is triggered, when the request itself fails, for example timeout and others. See the jQuery documentation. The error messages, which are produced by PHP appear only on request success. To display these, you could do for example: success: ...


0

is this normal that each plugins has its own version ? If the script isn't registered by Core there isn't much else a plugin/theme can do but register the script itself. If would be nice if there were some standardization, but that would be a tricky problem to solve. what could be the issue for the original error : Uncaught TypeError: ...


0

Have you tried to add the resource without http or https? Another words add the external source like this: wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'); wp_enqueue_script('jquery'); As you can see I am calling the jQuery resource without adding http or https.



Top 50 recent answers are included