HTML tags in WordPress image caption

I’m glad that better support should be added in version 3.4 but for now I’ve fixed the issue by changing the behaviour of image insertion so that it doesn’t use the shortcode. Here’s what I added to functions.php: add_filter( ‘disable_captions’, create_function(‘$a’, ‘return true;’) ); function image_send_to_editor_2($html, $id, $caption, $title, $align, $url, $size, $alt) { if … Read more

Thumbnail Cropping with add_image_size?

Refer to the add_image_size() Codex entry: <?php add_image_size( $name, $width, $height, $crop ); ?> The $crop parameter is the key: (boolean) (optional) Crop the image or not. False – Soft proportional crop mode ; True – Hard crop mode. Default: false That is: False (default): box-resize – (resize image against the constraining dimension) True: hard-crop … Read more

use wp_get_attachment_image() to show attachments

You’re obviously getting data returned for $attachments = get_posts(); otherwise, you wouldn’t be able to output $attachment->post_title. So the issue must be with your wp_get_attachment_image() call. The first thing I would check is: why are you setting the $icon parameter to true? This parameter is intended to output a mime-type icon, instead of the actual … Read more

Multisite Pull Recent Image Attachments from Blog ID

Use switch_to_blog to switch blog contexts to a specific blog ID. From there on it’s all down to get_posts of the attachment type. And switching back to the current context with restore_current_blog. Something like this: switch_to_blog( $blog_id ); $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => 5, ‘orderby’ => ‘post_date’, ‘order’=> ‘ASC’ ); foreach ( … Read more

Advanced Custom Fields

In Advanced Custom Fields the field editing screen where you add in the required fields and assign them to post edit screens did you choose image URL or Attachment ID for the image field? It sounds like you’ve got it set as image URL which will just return the URL to the originally uploaded file … Read more

Gallery post images on homepage?

You could use this loop for fetching the images from current post. <?php $images = get_posts(array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘posts_per_page’ => 5, ‘post_mime_type’ => ‘image’ )); if( $image ) { foreach($images as $image) : echo wp_get_attachment_link( $image->ID, ‘thumbnail-size’, true ); endforeach; } ?> reference: wp_get_attachment_link wp_get_attachment_image

Resizing Images for a Gallery-Plugin?

Its best practice to always use internal WordPress API functions that already exist in place of external scripts. You would need to regenerate the thumbnails yourself, which is not overly difficult, if for instance you give yourself a head start and study the source code of existing and similar solutions; Regenerate Thumbnails Plugin http://wordpress.org/extend/plugins/regenerate-thumbnails/ browse … Read more