WordPress.org

Forums

[resolved] Convert post content to featured image (4 posts)

  1. tulioatelio
    Member
    Posted 3 years ago #

    For more than a year i used blogger and now i decided it's way about time to go wordpress!
    I have a medium overall programing knowledge but i am facing a big problem and i need help.
    In blogger i always inserted thumbnails in the post's content, like:
    <p class="thumb"><img src="thumb.jpg"/></p> [... post content]
    I have 624 posts, they are all this way.
    First i thought about querying the posts, isolate the thumb url somehow and then update the database.
    But i see no special place in the database diagram for post thumbnails.
    know i am lost... please help :D

  2. s_ha_dum
    Member
    Posted 3 years ago #

    The images themselves are stored in wp-contents/uploads by default, if you upload the posts with the WordPress uploader.

    Images also have an entry in the *_posts table (post_type="attachment") with more metadata stored in *_postmeta.

    There is no special place for thumbnails. If you use the Media uploader and if it can (needs PHP's GD libray), WordPress will create thumbnails that look like 'thumb-150x150.jpg', but that size can be changed, that don't (as far as I have noticed) get individual references in the tables. WordPress depends upon that naming pattern to find them.

    However, I don't think you need to deal with any of that since you are dealing with URLs embedded in the post content. You should be able to search and replace the post_content column of the *_posts table.

  3. tulioatelio
    Member
    Posted 3 years ago #

    thanks, i just created a function to extract the thumbnail case the post does not have featured image

  4. buzzy0777
    Member
    Posted 2 years ago #

    How did you do that?

Topic Closed

This topic has been closed to new replies.

About this Topic