Day: December 22, 2013

Use WordPress Media Uploader in your Custom Plugin

This will make is Basicly what I did was adding this to my plugin: function test_admin_scripts() { wp_enqueue_script(‘media-upload’); wp_enqueue_script(‘thickbox’); wp_enqueue_script(‘jquery’); } function test_admin_styles() { wp_enqueue_style(‘thickbox’); } add_action(‘admin_print_scripts’, ‘test_admin_scripts’); add_action(‘admin_print_styles’, ‘test_admin_styles’); And later this part: <script language=”JavaScript”> jQuery(document).ready(function() { jQuery(‘#upload_image_button’).click(function() { formfield = jQuery(‘#upload_image’).attr(‘name’); tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’); return false; }); window.send_to_editor = function(html) { imgurl = jQuery(‘img’,html).attr(‘src’); […]

Read more

Make Div Appear and Reappear with javascript

Make a div with the same id as the select input and you should be good to go. $(window).load(function(){ $(document).ready(function () { $(‘.group’).hide(); $(‘#div1’).fadeIn(‘slow’); $(‘#div1’).change(function () { $(‘.group’).hide(); $(‘#’+$(this).val()).fadeIn(‘slow’); }) }); });

Read more