• I have a blog where I post some good promotions I find in my niche. When these promotions expire, I want to have a way to show this in post and on the feature image. Maybe like a banner that would say “Offer Expired”.

    My idea was to make it somehow with ACF and add a filed which would let me choose if this is expired or not. I would also like to add a note in the first line of each post when it is expired.

    I am back to WP after quite some time of pause, so I need help how to achieve that.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Assuming your theme calls the_post_thumbnail() to output the featured image, you could append the text to the related HTML through the “post_thumbnail_html” filter. For the same text in the post, you could prepend it to post content through the “the_content” filter.

    Text HTML appended to the featured image HTML will normally appear after and below the image. You can add some additional CSS that will move its positioning so that it’s over the image and styled appropriately. Perhaps you’d rotationally transform the text, increase its size, and add a contrasting drop shadow so it’s readable over any background image.

    The filter callback code can reside in a simple custom plugin or child theme. The CSS can be placed in the customizer’s Additional CSS section.

Viewing 1 replies (of 1 total)
  • The topic ‘Promotions post – add overlay to the feature photo if expired’ is closed to new replies.