First image from post – ENHANCED!
First off, I didn’t come up with this code. I worked long and hard on something very different, got stuck, went looking, found this and scrapped what I had.
This function will get the first image from a post, in this order:
- Featured image
- First image attached to post
- First image URL in the content of the post
- YouTube screenshot
- Default images for different categories [SET MANUALLY]
- Backup-default image if all else fails [SET MANUALLY]
Code and explanation can be found on PasteBin:
PasteBin: Image from Post (Featured, Attached, 1st Image, YouTube, Category Defaults, Backup-Default)
- The topic ‘First image from post – ENHANCED!’ is closed to new replies.