need help with 14 lines of code :D – newbie here

is a WORDPRESS snippet
i found this nice snippet on the web but because i don`t know php i need some help.
This code extract the attached picture from post and display it as a shortcode. I dont wan`t to modify my template and insert [postimage] (-> the shortcode) in my index.php

Code:

function cwc_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);
        return '<div class="postimage" style="width: '.$width.'px; height: '.$height.'px; float: '.$float.';">'.$fullimage.'</div>';
}
add_shortcode("postimage", "cwc_postimage");


my thumbs have "thumb" on custom fields (i need to copy image url and paste it in the custom fileds -> below posts in wp dashbord) and i need help to modify that code and add "thumb" automaticaly on image extracted from this piece of code.

View full post on Tycoon Talk

, , , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved