WordPress and jQuery [closed]

jQuery.noConflict() jQuery is included in WordPress in noConflict mode, so as to work with other javascript extensions that also use $ as an alias. Hence your above Version II will not work with the WP native jQuery loading. What is jQuery? jQuery is not a language. It is nothing but a (massive) javascript object. That … Read more

Hacking TinyMCE for better usability (shortcodes and html)

Have a look at my Gridster Plugin, it replaces every shortcode [gridster id=”” title=””] with a visual replacement, like you know from the -Shortcode. To change parameters of the current shortcode, you’re able to click a button and a tinyMCE modal will let you change anything within a user-friendly GUI. The functions are based on … Read more

AJAX returns response 0

Your action hook should be add_action( ‘wp_ajax_cc_author_change_postauthor’, ‘cc_author_change_postauthor_callback’ ); I think because of your wrong hook, your callback function is never called. You might have got this wrong aswell. In your JS code please change your action from cc-author-change-postauthor to cc_author_change_postauthor

Moving jQuery to the footer without using de-register in WordPress

You should use the param $scripts of the hook wp_default_scripts. In this hook was en-queued all default scripts, also jQuery and you can change his data, like the group for load in footer. add_action( ‘wp_default_scripts’, ‘_print_jquery_in_footer’ ); function _print_jquery_in_footer( $scripts ) { if ( ! is_admin() ) $scripts->add_data( ‘jquery’, ‘group’, 1 ); } Also in … Read more

jquery & ajax getting data to php in wordpress

Assuming that your script localization and other stuff are set up properly, there is an issue in your back-end script. Your data is in the following format: data : { action : ‘renove_vocabulary’, id_vocabulary : vocabulary, id_user : user } But you are trying to get the data as follows: $id_user = $_POST[‘user_id’]; $id_vacabulary = … Read more

Loading jQuery With Two Fallbacks

I use a similar pattern to enqueue jQuery from the Google CDN (as the CSS Tricks example). However in my footer (typically footer.php) I’ll usually hard code the following fallback. <script type=”text/javascript”> if (typeof jQuery === ‘undefined’) { document.write(‘<script src=”https://wordpress.stackexchange.com/questions/78740/<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.min.js” type=”text/javascript”><\/script>’); } </script> Let me explain what this does and why I … Read more

Extend 3.5 media uploader plugin to change button name

Figured it out using a different method. Help from here. $.fn.oeUpload = function(options) { // Set default options var defaults = { ‘preview’ : ‘.preview-upload’, ‘text’ : ‘.text-upload’, ‘button’ : ‘.button-upload’, ‘name’ : ‘Choose Image’ }; var options = $.extend(defaults, options); var uploader; $(options.button).click(function(e) { e.preventDefault(); //If the uploader object has already been created, reopen … Read more