Alter image output in content

Your better off adding your custom image data when you insert it into a post using media_send_to_editor, the caveat is this will not be applied to any existing images, only ones inserted after adding the function. To apply it to to existing content you will have use preg_match on the_content filter, but this can significantly … Read more

Upload images using FTP and show them in media

I know it’s one year old but just in case someone else is also searching: You could upload the main files (not all 3 sizes, just the original images) via FTP to another directory on your server and then use the Add-From-Server Plugin.

The WordPress Gallery, Grabbing The Link and Images?

Attachments in a gallery are their own posts, with some special settings. To get a list of all the attachments for a given post, you basically just create a new query and specify the post parent and attachment type. $gallery_images = new WP_Query(array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘post_status’ => ‘inherit’, … Read more

copy attachment title to description and alt text

You can make a query to loop through all the attachments, and then update the attachment info for each attachment in the while loop. Something like $args = array( ‘post_type’ => ‘attachments’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ) $query = new WP_Query($args) if($query->have_posts()): while($query->have_posts()): $query->the_post(); // 1. Get the attachment filename here and store … Read more

Dynamic-Image-Resize Plugin does not output anything

Ask the right guy Which you just did, so… here’s your answer from the developer. 🙂 What does the right output tell us? First of all, the public dynamic_image_resize() API function is just a wrapper for the singleton itself. When you take a closer look at the class, you’ll notice a __toString() method, which is … Read more

How to add php to theme to show alt attributes

Try adding these codes to your theme’s function.php file: function isa_add_img_title( $attr, $attachment = null ) { $img_title = trim( strip_tags( $attachment->post_title ) ); $attr[‘title’] = $img_title; $attr[‘alt’] = $img_title; return $attr; } add_filter( ‘wp_get_attachment_image_attributes’,’isa_add_img_title’, 10, 2 );