Re-order media links?

Edit: Added example of outputting the attachment’s id. Assigned it to the variable $attachment_id, since that’s how the core code refers to it. Note that the $post object (for the attachment) is passed into the callback of the attachment_fields_to_edit filter, so you’ll have access to all of the attachment’s properties. Yes, this can be done … Read more

Showing a placeholder/default img, if no featured image is set

Misspelling of thumbnail (thumnail) in the if statement. Also get_the_post_thumbnail does echo the thumbnail, but just returns the html. You need to echo it. Also, for checking if a post has a thumbnail, you can use has_post_thumbnail. if ( has_post_thumbnail($r->ID)) { echo get_the_post_thumbnail($r->ID, array(50,50)); }else{ echo ‘<img src=”https://wordpress.stackexchange.com/questions/44208/image_url”/>’; }

How do I add the featured image to the_content after the first paragraph?

You can do this using the ‘the_content’ filter: add_filter( ‘the_content’, ‘insert_featured_image’, 20 ); function insert_featured_image( $content ) { $content = preg_replace( “/<\/p>/”, “</p>” . get_the_post_thumbnail($post->ID, ‘post-single’), $content, 1 ); return $content; } Of course, you can add options to the the_post_thumbnail() function to define which size of thumbnail you’d like to use, etc… http://codex.wordpress.org/Function_Reference/the_post_thumbnail

Retrieve featured image as object

First get the registered image sizes and the featured image attachment id: $sizes = get_intermediate_image_sizes(); $post_thumbnail_id = get_post_thumbnail_id(); Loop through the registered sizes and create an array: $images = array(); foreach ( $sizes as $size ) { $images[] = wp_get_attachment_image_src( $post_thumbnail_id, $size ); } Combined as a function to place inside functions.php: function get_all_image_sizes($attachment_id = … Read more