• hi
    i need to a function to get new thumbnail in any size. for example 200×200
    For example :

    <?php
    // get the first image attached to the current post
    function aldenta_get_post_image($size = 'thumbnail') {
    global $post;
    
    $photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    
    if ($photos) {
    $photo = array_shift($photos);
    return wp_get_attachment_image($photo->ID, $size);
    }
    else{
    	return '<img src="'.get_bloginfo('template_url').'/default.jpg" border="0" />';
    }
    return false;
    }
    ?>

    echo thumb:
    <?php echo aldenta_get_post_image();?>

  • The topic ‘i need functions’ is closed to new replies.