How to modify wp.media to get and display multiple images

So, this works. I’d be happy to implement and credit improvements! /** * @Script: WordPress Multiple Image Selection in jQuery * @Version: 0.1 * @Author: CK MacLeod * @Author URI: http://ckmacleod.com * @License: GPL3 */ jQuery(document).ready( function( $ ) { var myplugin_media_upload; $(‘#myplugin-change-image’).click(function(e) { e.preventDefault(); // If the uploader object has already been created, reopen … Read more

Make jQuery library load before plugin files

If you look at the wp_enqueue_script Codex Documentation, you’ll see one of the options is $deps, this would mean that your script is dependent upon another script, simply add jquery as a dependancy and your scripts will load in the correct place. If you set a handle for the other scripts you can use them … Read more

How to add a ” waiting” icon for an ajax in WP frontend?

You can use the inbuilt spinner class : Add the class to the HTML where you want the spinner to appear, for example after your search button : <button type=”button” id=”searchsubmit”>Search Button</button> <span class=”spinner”></span> <!– Add this spinner class where you want it to appear–> In jQuery you should add the is-active class to the … Read more

WordPress AJAX File Upload – FrontEnd

Hi You have Use this COde For WordPress front-end AJAX file upload tutorial Code Here is my code: In my template file example.php <form enctype=”multipart/form-data”> <input type=”text” name=”support_title” class=”support-title”> <input type=”file” id=”sortpicture” name=”upload”> <input class=”save-support” name=”save_support” type=”button” value=”Save”> </form> This is in ajax-file-upload.js jQuery(document).on(‘click’, ‘.save-support’, function (e) { var supporttitle = jQuery(‘.support-title’).val(); var querytype = … Read more

tinymce is not defined when not using wp_editor

With help from a colleague, we dug through class-wp-editor.php Here are the necessary scripts to initialise jQuery tinyMCE if wp_editor has not been used beforehand (which calls these scripts). // Get the necessary scripts to launch tinymce $baseurl = includes_url( ‘js/tinymce’ ); $cssurl = includes_url(‘css/’); global $tinymce_version, $concatenate_scripts, $compress_scripts; $version = ‘ver=” . $tinymce_version; $css … Read more

wordpress json custom taxonomy problem

I would have done it as following, I am sure experts here will have a better way but following is what I could come up with in hurry. First create your controller file in your theme directory (or any other if you like) with the following content. For this example the file name is korkmaz.php … Read more

How to load the WordPress jquery in the section

By default if you enqueue jquery then it gets added in header but if any plugin is changing the default behavior of it and adding it in footer instead of header then you can use the following code to alter it and force it to add in header again. function insert_jquery(){ wp_enqueue_script(‘jquery’, false, array(), false, … Read more