Tag Info

New answers tagged

0

As far as I know, the save_post hook kicks in, after the post was stored or updated in the database. Any Idea how to prevent this, when a metabox field validation error occurs, i.e. is empty?


1

Your AJAX callback method should be outputting something followed by a die() statement. function wp_insert() { ..your code echo $whatever_your_results_are; // die(); } I would also recommend against prefixing your custom methods with wp_. That should be reserved for WordPress and will cause confusion to other developers - and probably you ...


1

First of all, some recommended reading - AJAX in Plugins. I realise this is not a plugin, but the Codex is still relevant, and as you'll see in the PHP section, you can use the WP AJAX handler to handle front end calls as well as those from the admin area. Javascript For this, you would be better advised putting your JS in an external *.js file that is ...


0

ave you tried to put it in the Shortcode-function? I would suggest this: function my_shortcode() { ?> <script> alert('test') </script> <?php } add_shortcode( 'my_shortcode', 'my_shortcode');


1

What would you do if the user uses a proxy and randomizes his IP address? There are numerous browser plugins to simplify that to a click of a button to download multiple times. The same goes for cookies. Aside from that you are trying to collect data that allows to identify users, which is illegal in lots of countries. What (could) work much better is a ...


1

How this line (9th) is created within your theme code? <script type="text/javascript" src="/wp-content/themes/blankslate/js/jquery-1.11.1.min.js"></script> If it is hard-coded in header.php, then I would recommend to remove it. Scripts should be enqueued instead of hard-coding them. Next, you can de-register jquery.migrate script with the ...


-1

if ajax returns zero, the function bound is not registered properly have a read: http://arresteddeveloper.net/woocommerce-get-variation-description-variation-select-changes/ this might point you in the right direction


0

This is a javascript issue. You have to prevent form submission to stop the page from reloading. See event.preventDefault() in jQuery docs. jQuery("#Submityourskill").click(function(event){ event.preventDefault(); // the rest of your code });


-1

use the jquery inside $(document).ready also you can use jQuery instead of $ sign i hope it will work fine then.


0

Currently I'm assuming that is is backend (front end is slightly different), but it's very easy to implement on the frontend if required. You are correct in thinking that because you haven't used the WordPress admin-ajax.php file, all the goodness of WordPress is missing. Fortunately this is easily fixed. Before continuing I recommend that you take a look ...


0

For what it's worth - I recently ran into this problem with the editor disappearing with wp 4.1 after a site migration. The issue happened to be that "accessibility mode" (The link under screen options in the widget editor) was turned on.


0

You need to wrap your jQuery click event in a DOM ready function. (function($) { $('.signUp').click(function() { $('.signUpForm').toggle(); }); })(jQuery);


1

If you are going to add a inline script that depends on jQuery, the best and correct way is to use wp_enqeue_scripts action hook, or wp_footer, depends on the situation, combined with wp_script_is() function: add_action( 'wp_footer', 'cyb_print_inline_script' ); function cyb_print_inline_script() { //Check that jQuery has been printed if ( wp_script_is( ...


-1

You can add them into functions.php file, code below: //load js function load_js(){ if(is_page(Page ID, Page Title or Page Slug)){ //put your js code here } } add_action('wp_footer', 'load_js', 20); //for footer add_action('wp_head', 'load_js', 8); //for head or: function load_js(){ if(is_page(19)){ ...


1

Your code is wrong. You are confusing wp_enqeue_script function and wp_enqueue_scripts action. It should be: function theme_script(){ wp_deregister_script( 'jquery' ); wp_register_script('jquery',get_template_directory_uri().'/sliderengine/jquery.js'); wp_enqueue_script('jquery'); ...


0

No comments but ill answer anyway for future clueless jqm developers as me. apparently (wasent clear for me base on my regular web dev experience) that if the destination is not a jquery mobile page it wont load and show blank... weird? or maybe there is other explanation that i didn't noticed while deleting and rebuilding the code.


0

Two thoughts: 1) Doesn't isotope have a method for adding "stuff"? 2) What about adding a custom field or two, to the product and then use those to create an element before / after that product? 3) Instead of injecting the message via the loop just create the div / wrapped with some - id or class - and then use jQuery to fill those with something random. ...


0

wp_enqueue_script() also registers the script. So, you'll also need to de-register it first. This code should work depending on how and where the script is enqueued. function my_dequeue() { wp_deregister_script( 'ocmx-jquery' ); wp_dequeue_script( 'ocmx-jquery' ); } add_action( 'admin_enqueue_scripts', 'my_dequeue', 10 ); You might also need to ...


1

I haven't tested this, but this should work and don't forget to replace the jQuery selector with your own: $(function() { if(typeof jQuery.datepicker === 'function'){ $( ".your_date_picker_field_selector" ).datepicker({ beforeShowDay: function (t) { var e = t.getDay(); return [e == 3, ""] } }); } }); ...


1

Here's a working example: add_action( 'wp_enqueue_scripts', 'menu_scripts' ); function menu_scripts() { wp_enqueue_script( 'responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/js/custom_script.js', array( 'jquery' ...


2

Replacing the WordPress version of jQuery is generally a bad idea. Checkout Pippin's article Why Loading Your Own jQuery is Irresponsible for more information. Instead of completely replacing jQuery, you could instead move the supplied version to the footer. However you need to be mindful that this will most likely break plugins if they load scripts in the ...


1

the following may work function wpdocs_dequeue_script() { wp_dequeue_script( 'jquery' ); } add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );


0

If the script is there it should work. It's probably failing because you're not declaring the jquery dependency and you're not wrapping it correctly (in no conflict mode). Here's how your script should be enqueued: function custom_scripts() { wp_enqueue_script( 'unique-custom-script', get_stylesheet_directory_uri() . '/custom.js', ...



Top 50 recent answers are included