Support » Fixing WordPress » Need multiple image sizes inside loop

  • The loop currently gets the first image in a post..Im not sure if it’s getting the thumbnail size or what, but I can’t change it.

    I use this function inside functions.php:

    function first_image() {
    $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
      if($files) :
        $keys = array_reverse(array_keys($files));
        $num = $keys[$j];
        $image=wp_get_attachment_image($num, 'large', false);
        $imagepieces = explode('"', $image);
        $imagepath = $imagepieces[1];
        print "<img src='$thumb' class='thumbnail' />";

    thumbnail class when changed has no effect:


    The loop simply calls:

    <?php first_image(); ?>

    I want to be able to use different widths and heights for the first image depending on various conditions.

  • The topic ‘Need multiple image sizes inside loop’ is closed to new replies.