Include captions

st Note: // Prepare the code for safety $images = $wpdb->get_col( $wpdb->prepare( ” SELECT ID FROM %s WHERE post_type=”attachment” AND ID IN ( %s ) ORDER BY menu_order ASC “, $wpdb->posts, $meta ) ); nd Note: Look into what you already got: // Inside the foreach loop echo ‘<pre>’; var_dump( $att ); echo ‘<pre>’; rd … Read more

Query for recent images across multiple posts

You can use get_posts or create a new WP_Query using the following args (or something similar). <?php $args = array( ‘post_type’ => ‘attachment’, // attachment post type ‘post_status’ => ‘inherit’, // all attachments have this post status ‘post_mime_type’ => ‘image’, // make sure you get images only ‘posts_per_page’ => 5 // however many images you … Read more

Randomly add a ‘ul’ list of images

Adding the following to your theme’s functions.php file will let you use a shortcode ( [wpse73055-random-images] ) with an optional num parameter (i.e. [wpse73055-random-images num=5] to display 5 random images). function wpse73055_get_random_images( $atts ) { extract( shortcode_atts( array( ‘num’ => 10 ), $atts ) ); $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => … Read more

Image display from custom field

If you use update_post_meta() than also use get_post_meta() (see Codex) and not get_post_custom $order = get_post_meta( $post->ID, ‘order’, true ); $image = get_post_meta( $post->ID, ‘image’, true ); And than check in your HTML source what your image tag looks like. I bet it will look like this: <img src=”https://wordpress.stackexchange.com/questions/75550/coffee_star.jpg” /> What about the path to … Read more

Insert image in comment reply

What you’re looking for could be a wp_editor() in comment form : wp_editor( $comment->comment_content, ‘content’, array( ‘media_buttons’ => true, ‘tinymce’ => false, ‘quicktags’ => $quicktags_settings ) );

Is there a shortcut to change bulk BMP images to JPG images in a site?

Assuming you add the files with the matching filenames in the appropriate wp-content/uploads/ folders you could run a few SQL queries to update the WordPress database to use the .jpg files. Assuming your wpdb prefix is wp these queries would be: UPDATE wp_posts SET post_mime_type = replace(post_mime_type, ‘image/bmp’,’image/jpeg’); UPDATE wp_posts SET guid = replace(guid, ‘.bmp’,’.jpg’); … Read more