0

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?

1 Answer 1

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];
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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