
WORDPRESS SHORTCODE: EASILY DISPLAY THE LAST IMAGE ATTACHED TO POST
First, we have to pulp a following formula in your functions.php file, in sequence to emanate a shortcode. duty sc_postimage($atts, $content = null) { extract(shortcode_atts(array( "size" => ‘thumbnail’, "float" => ‘none’ ), $atts)); $images =& get_children( ‘post_type=attachment&post_mime_type=image&post_parent=’ . get_the_id() ); foreach( $images as $imageID => $imagePost ) $fullimage = wp_get_attachment_image($imageID, $size, false); $imagedata = wp_get_attachment_image_src($imageID, $size, false); $width = ($imagedata[1]+2); $height = ($imagedata[2]+2); lapse ‘<div class="postimage" style="width: ‘.$width.’px; height: ‘.$height.’px; float: ‘.$float.’;">’.$fullimage.’</div>’; } add_shortcode("postimage", "sc_postimage"); Once done, we can simply arrangement a final picture trustworthy to post by regulating a postimage shortcode as shown below: [postimage] Many interjection to Madcore for this overwhelming recipe! Wanna have income blogging?
Here is a strange post:
WordPress Shortcode: simply arrangement a final picture trustworthy to post



