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've just moved to another theme, and it uses the custom field bigimage for associating an image with a post, instead of using WordPress's post thumbnails. How do I copy the URLs of all existing post-thumnails to their corresponding post's bigimage custom field?

Could we possibly write a bunch of MySQL statements to achieve this?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I wouldn't bother doing that.

I'd just find the places in your theme files that call the custom field (probably something like "echo get_post_meta('bigimage')" or something) and replace those with a the_post_thumbnail() tag.

This saves you the trouble of messing with the data, and it makes administration much, much simpler going forward--which is kind of the point of post thumbnails. And it'll probably take less time than rigging some SQL to copy all that data.

share|improve this answer
add comment

Sorry for not having a specific answer but this will point you in the right direction, you should be able to do this in your functions.php.

First off you probably want to get the post thumbnial using get_the_post_thumbnail

I would create an array function to get the post thumbnails, I will assume the "bigimage" has a key value in $wpdb->postmeta. If so you can use the http://codex.wordpress.org/Function_Reference/add_post_meta to then insert the image url or id or whatever into that custom field per post.

share|improve this answer
add comment

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.