Parsing post->ID in included plugin file

First issue- you can’t access any data because your AJAX request is an entirely separate request from the one that loaded the page you’re making the request from. This is not unique to WordPress. You have to pass the data you want to operate on along with your AJAX request. Second issue- calling your plugin … Read more

wpquery via ajax

The accepted answer on this post: Ajax and autocomplete does an extremely good job of showing exactly how to integrate an ajax call within WordPress.

Change Query Arguments (filter) with jQuery/Ajax or PHP?

The permalink structure you’ve described above e.g…./hotels/hamburg/features/sea-face isn’t really something that could be achieved by using custom fields. You would be better off creating a new taxonomy called ‘features’ and populating it with terms like ‘sea-facing’ and any others. In order to do queries for multiple taxonomies I would recommend the excellent Query Multiple Taxonomies … Read more

WordPress Front-End Theme Editor

In WordPress 3.4 you have something called Theme Customizer that provide a optionpanel within wp-admin that enables you to see the changes in real-time. Maybe thats an option to go? Look at this video to see how it works: http://www.youtube.com/embed/amUjCfpIsJ4 Then you have themes like Headway that you can change the theme appearance on the … Read more

Connect Agile Carousel to WordPress AJAX

After some digging, I decided to try a hunch and it ended up working. Whether this is the sanctioned solution or not, but it has worked in my testing. For the AJAX url, add the $_GET variable ?action=[ajax_action] where [ajax_action] is your requested action. (ie. http://www.example.com/wp-admin/admin-ajax.php?action=[ajax_action]) Then make add_action(‘wp_ajax_nopriv_…’) include your action variable, ie. add_action(‘wp_ajax_nopriv_[ajax_action]’, … Read more

Converting a working AJAX form to work with WordPress

You have a typo: wp_ajax_ ajaxfunction. there’s a space after the underscore. also, use wp_localize_script to set your admin-ajax path: wp_enqueue_script( ‘contact’, get_bloginfo(‘template_directory’) . ‘/subscribe.js’, array(‘jquery’), ‘1.0’ ); wp_localize_script( ‘contact’, ‘ContactAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) ) ); then in your javascript, use ContactAjax.ajaxurl

Getting selection of posts based on loop variables via Ajax

You can easily add whatever variables you want to your AJAX call. Using jQuery you can set a AJAX action like this: jQuery.post( ‘your-url-to-admin-ajax.php’, { action: ‘your_called_function’, argument: ‘year’ or ‘category’, some_other_var: ‘some value’ }, function( response ) { if(response) { } else { } } ); Then in your functions.php add this: add_action( ‘wp_ajax_nopriv_your_called_function’, … Read more