How to enable the content editor as a droppable target with jQuery-ui?

In the above example the following line: jQuery(“.myDiv”).find(“li”).each(function(){ should be: jQuery(“.keywords”).find(“li”).each(function(){ That should enable the list items to be dragged and dropped. To allow the items to be dropped on the TinyMCE textarea the following code works. $(‘#editorcontainer’).droppable({ drop: function(event, ui) { alert(‘dropped’); //NOW FIRES! //Dynamically add content tinyMCE.activeEditor.execCommand(‘mceInsertContent’, false, ‘New content.’); } });

Googles jQuery: Are There Avantages to Using It?

The big advantages are the Google CDN and the client side caching of the library. Your visitor will probably have a version of the jquery library in the browsers cache already, so he doesn’t have to re-download the script from the local version used by WordPress. One big disadvantage by including the library from the … Read more

Override default jquery ui library with newer version

Add the following code in functions.php file of your theme that will remove default jquery ui core and will add your provided latest jquery ui core file from your theme. function my_scripts_method() { if(!is_admin()){ wp_deregister_script( ‘jquery-ui-core’ ); wp_enqueue_script(‘jquery-ui-core’, get_stylesheet_directory_uri().’/jquery.ui.core.min.js’, array(‘jquery’), ‘1.9.2’, 1 ); } } add_action(‘wp_enqueue_scripts’, ‘my_scripts_method’); Tell me if it works for you or … Read more

Cancel jQuery ‘noConflict’ – is it really unsafe?

The problem with the $ alias is that a number of libraries quite puzzlingly decided to use the same variable as an alias. If two libraries try to use the same variable, one or the other will win and anything dependent on the other one will break. If you are only using jQuery, and never … Read more

Is it safe to include a javascript file in a template’s php file?

As @N00b mentioned Yes, it is safe adding a JS script as long as it doesn’t include any sensitive information. JS is fully exposed to client, you shouldn’t do it anyway. But your situtaion it is better to create a site specific custom plugin and add JS using it. Example : function themeslug_enqueue_style() { wp_enqueue_style( … Read more

WordPress ajax function parameter value not being passed

First of all you should read the codex on AJAX_in_Plugins Secondly you should look at wp_localize_script to get the value for the admin-ajax url to your javascript. $data = array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ) ); wp_localize_script( ‘ajax-script’, ‘ajax_object’, $data ); In your javascript, you are then meant to reference the localized data jQuery(“.selectbox”).change(function(){ var … Read more

Jquery conflict

At least one issue I can see is that you’re including the jQuery framework at least twice. The first line <?php wp_enqueue_script(“jquery”); ?> Is the preferred method of including jQuery. Your installation of WordPress happens to include jQuery version 1.4.2. This allows good plugin and theme developers to leverage jQuery and not accidentally include it … Read more

jQuery breaking my wordpress site

You should not include jQuery manually. jQuery is included in WordPress by default, but isn’t loaded on every page unless a plugin or theme requests it. This can be done using: add_action(‘wp_enqueue_scripts’,’my_scripts’); function my_scripts() { wp_enqueue_script(‘jquery’); } Here is function reference for wp_enqueue_script (the function) and wp_enqueue_scripts (the action hook). In addition to that, WordPress … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)