How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?

Filter ‘the_content_feed’ or ‘the_excerpt_rss’ and use a thumbnail image of your choice. Sample code, not tested: add_filter( ‘the_content_feed’, ‘wpse_70249_custom_thumb’ ); add_filter( ‘the_excerpt_rss’, ‘wpse_70249_custom_thumb’ ); function wpse_70249_custom_thumb( $content ) { global $post; $thumb_size=”post-thumbnail”; if ( in_category( ‘orange’, $post ) { $thumb_size = array ( 500, 500 ); } if ( in_category( ‘apple’, $post ) { $thumb_size … Read more

WordPress Image Attachment using remote image

You’ll want to get very familiar with wp_insert_attachment(), download_url() and media_handle_sideload(). It’s a bit lengthy to get into the details here, but it absolutely can be done. I used these methods to create a media tab that allows a user to put in a vimeo/youtube URL which I store in a postmeta and use their … Read more

wordpress get gallery images title

In WordPress attachments are stored as posts so you can use most of the post specific WordPress calls and functions to read/write data associated with the attachment. This applies to post meta data for an attachment as well. So in this case, since you have the post ID ( same as $attachment_id ) you can … Read more

How to keep WP from recompressing Full Size images

Using a filter for jpg_quality will hellp you to set your quality for uplaoded images. add_filter(‘jpeg_quality’, create_function(‘$n’, ‘return 70;’)); In most good implementations of Image Optimization you can find a various usae of ImageOptimization tools such as optimng/jpegtran etc, there a lot of plugins that help you to do that.

Multiple images in one attachment page

An attachment page is dedicated to a single attachment media item (image, video, audio etc.). You can change it’s behaviour by editing single-attachment.php. However this is not recommended. It is possible to create galleries and insert them in posts. Or install a plugin that displays custom posts as galleries of images.

How can I attach hotlinked images in posts/pages within the same server?

No complete code, but I know you can stick it together. 🙂 Find all post IDs of unattached images (borrowed from wp-admin/upload.php): global $wpdb; $lost = $wpdb->get_col( ” SELECT ID FROM $wpdb->posts WHERE post_type=”attachment” AND post_parent > ‘0’ AND post_parent NOT IN ( SELECT ID FROM $wpdb->posts WHERE post_type NOT IN ( ‘attachment’, ‘” . … Read more

Out of memory error reporting

How do your users upload photos? You’re right about register_shutdown_function. It seems to work well in my code, though I only ever call my back-end via AJAX (I’ve also got file upload functionality), and so only need to account for this case. Here’s how I set it up in my plugin. Outside of the plugin … Read more

Extracting gallery images in WordPress 3.5 on index.php

get_the_content is a template tag and would only work reliably inside a Loop. That means that you should also be able to use the $post global instead. global $post; // may not be necessary unless you have scope issues // for example, this is inside a function $post_content = $post->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $array_id = … Read more