Archived topic
Filter function for post thumbnail
3 replies · Started by Caro on September 29, 2016
Hi!
I'm trying to change the image wich is shown on the homepage, but only for the first post.
I want to change it from the thumbnail to the first image of the post.
What is the right function I can add a filter to?
I already tried 'get_post_thumbnail', but that didn't work.
Thanks in advance!
Hi there,
I'm not sure if there is such a filter for something like that.
Are you wanting to do it automatically for the latest posts? Or is it just this one specific post?
Hi Tom!
It should work automatically.
I'm not looking for a filter specifically for the first thumbnail on the homepage, but a filter for the thumbnail in general. Then I could limit my changes to this specific thumbnail via php.
Do you understand what I mean? ;)
You can find the function for the featured image here: https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/
You might be able to use the post_thumbnail_html filter, but I'm not sure. Stack Overflow might be the best place to ask.