jQuery Image Annotation

It sounds like you are asking for two features here: Image annotation Image comments You referenced a plugin for the first, and WordPress supports the second out of the box! As another choice, in the last link you provided, that person is using Flickr to handle their annotations and comments. This is another great option … Read more

Update Loop with Form

Yes, AJAX is the way to go. Basically, you can write your own callback function for WP’s ajax hook in your theme’s functions.php file. And then your function can return data in any format you choose. I generally return JSON. I’ll walk you through setting it up. First, since it doesn’t appear that your visitors … Read more

The correct way to call posts with ajax

As @MatthewBoynes already stated, making a $.post() request for every image might bring some overhead. A maybe better solution would be to grab and cache them, then throw them into your js files using wp_localize_script(). $attachments = get_posts( array( ‘post_parent’ => get_the_ID() ,’post_type’ => ‘attachment’ ,’posts_per_page’ => -1 #,’exclude’ => get_post_thumbnail_ID() // only needed if … Read more

How to load some jquery code to make validation in the theme customizer?

Create a /js subfolder in your theme directory, if such does not exist already. Save your script to a file in said folder. Then, in functions.php: if ( is_admin() ) { global $pagenow; if ( ‘customize.php’ === $pagenow ) { add_action( ‘admin_enqueue_scripts’, ‘wpse107236_enqueue_customizer_script’ ); } } function wpse107236_enqueue_customizer_script() { wp_enqueue_script( ‘your-script-handle’, get_template_directory_uri . ‘/js/your-script.js’, array( … Read more

Ajaxing function in widget class

If this is in a widget class, you need… add_action(‘wp_ajax_my_func’, array($this,’my_func’)); … not just… add_action(‘wp_ajax_my_func’, ‘my_func’); However, I suspect there to be more problems than just that due to the context you are using this in. But without more code, that is all I’ve got. Based on new information in the question… Both your function … Read more

Ajax with jQuery UI dialog not working

Assuming your javascript and ajax action code are otherwise correct, target admin-ajax.php with the correct path by localizing your enqueued script: wp_localize_script( ‘your_script_handle’, ‘script_data’, array( ‘admin_ajax’ => admin_url( ‘admin-ajax.php’ ) ) ); Then in your javascript, reference that URL with: url: script_data.admin_ajax EDIT- ah, missed this the first time: $wpdb->feedmanager isn’t set unless you’ve explicitly … Read more

Using jQuery in widget development

You can hook into the DOMNodeInserted event to find out when your widget has been added to the side bar. jQuery(document).on(‘DOMNodeInserted’, ‘.widget-top’, function () { alert(jQuery(‘.widget-title’, this).text()); }); The code above will alert to any newly added widget. Once you’re hooked into the newly created widget, you can traverse it to find your specific class … Read more