Media handle sideload not working

For those having similar problem, I cleared web-server’s /tmp partition being filled with temp files. The root cause was actually that my hosting provider sets the /tmp partition to be 128MB when on their VPS, which is far too small for the size of uploads that I want to be able to do.

Audio and video shortcodes not working properly

Okay, there are two things going on. First, since you are running WordPress 3.6, you don’t need to run any other media player plugins. Deactivate Widgetkit and use the following shortcode to add your audio player: The reason you aren’t seeing the play button on your players is that your web server is not serving … Read more

Add select field to media uploader that adds a class to the image

To apply the class you need a custom function to do something with the value of your setting. To make sure the selected stays selected use the WP selected() function $form_fields[‘image-type’][‘html’] = “<select name=”attachments[{$post->ID}][profile_image_select]”>”; $form_fields[‘image-type’][‘html’] .= ‘<option ‘.selected(get_post_meta($post->ID, “_profile_image_select”, true), ‘default’,false).’ value=”‘ . $normal_image . ‘”>Normal Image</option>’; $form_fields[‘image-type’][‘html’] .= ‘<option ‘.selected(get_post_meta($post->ID, “_profile_image_select”, true), ‘default’,false).’ value=”‘ … Read more

How to side load an image from a service

Short answer, you don’t. Functions like sideload are for importing images into WordPress itself and using all the normal media library stuff. For images on an external service, use normal img tags. If you want to copy an image from a URL, you sideload it. Not otherwise.

add_image_size landscape or portrait

What you’re asking for is functionally equivalent to scaling images to fit within a bounding square of each size, so could be achieved with this: add_image_size(‘big_xxl’, 4500, 4500); add_image_size(‘big_xl’, 3300, 3300); add_image_size(‘big’, 2100, 2100); add_image_size(‘medium’, 1250, 1250); Consider a landscape image that is 5000×500. These rules will generate images scaled to 4500, 3300, 2100 and … Read more

Add a header before fields added with the attachment_fields_to_edit() filter

I’ve found out that you can use the tr attribute for creating entire rows: function my_attachment_fields_to_edit( $form_fields, $post ) { $form_fields[‘attachment-header’][‘tr’] = ‘ <tr> <td colspan=”2″> <h2>My title</h2> </td> </tr>’; $form_fields[‘attachment-url’] = array( ‘label’ => __( ‘URL’, ‘plugin’ ), ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘_attachment_url’, true ) ); $form_fields[‘attachment-width’] = array( ‘label’ => … Read more