Updating User Profile with AJAX not working

This whole thing works as far as I can tell. In the future it may be easier to debug things by using PHP error_log() to write to the debug.log at certain points, like inside your ajax callback. If you’re only wanting to run this ajax for logged in users, you can drop the wp_ajax_nopriv hook … Read more

trigger(‘change’) not working

To use a custom control, you need a field with special attributes to be linked to the “publish” button. if you don’t want to display this field, you can generate a hidden field like that : class WP_Test_2_Customize_Control extends WP_Customize_Control { public function render_content() { ?> <input id=”<?php echo htmlspecialchars(“_customize-input-{$this->id}”);?>” type=”hidden” <?php $this->input_attrs();?> <?php if … Read more

Modify this loop to fit my jQuery slider (slides)

Tried very simple math. <div class=”slide”> will print after every 4 post. So, if statement with old school logic $i%4 == 0 <div class=”slides_container”> <?php $args = array( ‘post_type’ => ‘fastighet’, ‘numberposts’ => -1, ‘orderby’ => ‘ASC’ ); $posts = get_posts($args); ?> <?php $i = 0; foreach($posts as $post): ?> <?php if($i%4 == 0): ?> … Read more

Ajax pagination works only first and third time

@kennypu in stackoverflow saved my life with this: t’s because you’re changing the contents of #paginar, so what happens is the event on the links are getting cleared. depending on your jquery version, you can either use .live() or add the even to the #pagi-container instead: $(‘#pagi-container’).on(‘click’,’#paginar > a’,function() {… } my finished code is … Read more

jQuery Validate wp_editor

Per the jQuery noConflict Wrappers section of the wp_enqueue_script() Codex page, the $ variable is not available in WordPress. You can replace $ with jQuery in your jQuery code, or do something like this: jQuery(document).ready(function($) { // your code here . . . });

Basic ajax call in WordPress

You have to use the admin-ajax handler to do the AJAX call. Replace file.php in var url = “file.php”; with yoursite.com/wp-admin/admin-ajax.php?action=simple_ajax And in your plugin / functions.php file, add add_action(‘wp_ajax_nopriv_simple_ajax’,’process_simple_ajax’); //for non logged in user add_action(‘wp_ajax_simple_ajax’,’process_simple_ajax’); //for nlogged in user function process_simple_ajax(){ $data = $_REQUEST; // retrieve your submitted data wp_send_json($data); // return the processed … Read more