Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrapwp_autoset_featured_img Image size #108

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

bootstrapwp_autoset_featured_img Image size #108

jonohale opened this issue Feb 26, 2013 · 1 comment

Comments

@jonohale
Copy link

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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant