rachelbaker / bootstrapwp-Twitter-Bootstrap-for-WordPress

CSS toolkit from Twitter for use as a WordPress theme
http://twitter.github.com/bootstrap
651 stars 136 forks source link

bootstrapwp_autoset_featured_img Image size #108

Open jonohale opened 11 years ago

jonohale commented 11 years ago

I've noticed that this function does not use the wordpress thumbnail size options set in the admin section.

I'm also trying to call the size using wordpress standard way, e.g. bootstrapwp_autoset_featured_img('thumbnail') But i see there is no code for it, and can't figure out how to add it.

Code currently looks like this after my testing:

function bootstrapwp_autoset_featured_img() {
$post_thumbnail = bootstrapwp_post_thumbnail_check();

  if ($post_thumbnail == true ){

return the_post_thumbnail('thumbnail');

  }

if ($post_thumbnail == false ){

  $image_args = array(

            'post_type' => 'attachment',

            'numberposts' => 1,

            'post_mime_type' => 'image',

            'post_parent' => $post->ID,

            'order' => 'desc',

            'size' => 'thumbnail',

      );

  $attached_image = get_children( $image_args );

         if ($attached_image) {

                            foreach ($attached_image as $attachment_id => $attachment) {

                            set_post_thumbnail($post->ID, $attachment_id);

                            }

        return the_post_thumbnail( array(65,65) );

      } else { return " ";}

    }

  }  //end function
jonohale commented 11 years ago

Also, being able to just call the image URL would be awesome.