bootstrapwp_autoset_featured_img Image size #108

Open
jonohale opened this Issue Feb 26, 2013 · 1 comment

Projects

None yet

1 participant

@jonohale

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment