how to create the_post_image_url()
-
In WordPress 2.9 there’s a new function for adding a thumbnail (or larger) image to a post. If you put the_post_image() in your themes, it will print out the <img> associated with a given post. It’s pretty great!
Before this function, I was using custom fields to add thumbnails to posts. The way it worked was that I would just put the URL to the image in a custom field. Because the custom field had the URL alone, I could use this in CSS as well as in PHP/HTML. I found this quite useful.
So while the new function is great for outputting an img, I would like to have an additional function that would just output the img’s src. I think it could be the_post_image_url(). I looked at the wordpress source code, but I don’t have the expertise to write this function. Does anyone have some good ideas on how to start?
Thanks!
The topic ‘how to create the_post_image_url()’ is closed to new replies.