Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am developing a large ecommerce site using Wordpress and WP Ecommerce plugin. I recently overhauled the theme and framework. Where as before I was only required to set a featured image for a product, the new framework insists the image be "used as product image" or "inserted into post".

As there are 3000 or so images/products; I need a quick way to set the featured images as post/thumbnail images.

Is there a quick solution to this? My initial instinct suggests I can copy the featured image value in the mySQL database and insert it into the corresponding value for thumbnail/product image with an SQL statement. Am I wrong? If not, does anyone have any idea how this phrase will look?

share|improve this question

1 Answer 1

That sounds weird because post thumbnails were changed to Featured Images with WP 3.0.

I guess you're talking about some custom field or metabox your framework adds on post edit. You could grab _thumbnail_id which is the key in the wp_postmeta table that stores what you're looking for.

But to me you'd better usewp_get_attachment_img_src:

if(has_post_thumbnail($post->ID))
{
   $img = wp_get_attachment_img_src(get_post_thumbnail_id($post->ID), 'the_image_size');
   //  URL is the first data of the array
   echo $img[0];
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.