Updating custom post meta with ajax

If you load a file directly none of the WordPress functions will work. That is why you should nearly always use the AJAX API. The AJAX API solves this problem. Everything loads in WordPress context. You would wrap your processing PHP is a function: function my_ajax_cb_wpse_108143() { $cote = get_post_meta($_POST[‘id’], ‘cote’, true); if($_POST[‘cote’] == ‘like’) … Read more

Stop loading more posts if none left AJAX

Yes use wp_query 🙂 Anyway, to prevent loading posts while you’re out of pages, you need to know the current page number last loaded and the total number of pages that exist. Total pages that exist: $max = $wp_query->max_num_pages; Current page: just count it in your load loop, so set the var to 1, then … Read more

How to load a plugin when doing an Ajax call? [duplicate]

You are not using ajax right. Why are you adding your ajax callback function to the init action? You need to read http://codex.wordpress.org/AJAX_in_Plugins Attach your ajax callback function to wp_ajax_your_defined_action like this: add_action( ‘wp_ajax_your_defined_action’, ‘your_callbck_function’ ); For this to work you have to use wp-admin/admin-ajax.php as your ajax url and you have to post your_defined_action … Read more

Display ajax preloader for large images within posts

How you said one option is to place a preloader while the image is loading. If you cannot touch so deep with JavaScript and PHP I have one simple sugestion which I think will work for you. <div class=”image-preloader”> <img src=”https://wordpress.stackexchange.com/questions/129186/yourimage.jpg” alt=”” /> </div> Create a wrapper (holder) around your image. With CSS put the … Read more

Dynamic Gallery

You can use Advanced Custom Fields plugin – paid, to to that: http://www.advancedcustomfields.com/add-ons/gallery-field/ Plase what a video. Also on lightbox you need this Jquery plugin: http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/ Create a custom post type with name gallery. Then create a page-gallery.php and put this code: : <?php $args=array( ‘post_type’ => ‘gallery’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 12, ‘paged’ … Read more