NO BUG: Category archive shows a single featured image

Hi,
I recorded a video: Jam

The problem I’m facing is that I have a archive template with a pega title area that is colored, but shows a featured image if is set.
The problem is that the category page in the frontend shows an image in this area that comes from the single posts. I think this shouldn’t occur.

I know there are workarounds, like modifying the class and creating an archive template without this image, but wanted to show this in case is a bug. I would love not to create more templates though :slight_smile:

version: 1.11.1.1

Thank you

Hey. At first, I thought it was a bug/issue, but after checking once again and talking with others, I think it works like it’s supposed to, because WP will automatically get first post on archive pages, and that’s where it will get the featured image from.

I’m wondering what image would you expect there, in archive page?

Thanks,
Matej

Hi Matej,

1. I’m wondering what image would you expect there, in archive page?
R: out of the box WP doesn’t offer a featured image for categories, but they can be set up (custom code, ACF…). I expect a featured image set for that specific category, if none is set, no image.

  1. It’s weird that for example, the {post_title} brings the title of the category, but the {featured_image} brings the featured img of a single post. In my case, the image will change everytime.

  2. Also weird it doesn’t happen on subcategories.

  3. If this could be conditioned to IF featured:image is set, it would be nice.


It seems it's a WP issue, not much you can do about it, so no worries. Thanks for your help :slight_smile:

Yep, I’ll mark it as no-bug then :slight_smile:

Sorry I edited the message, no way I can condition a background?? (it’s the background of the main section, if I condition the whole section, it will not show it unless a featured image is set)

Hi @23devs,

If you want to show the category / term’s image on Term pages, you can use {term_meta:thumbnail_id} or {term_mate:your_custom_field} or {acf_your_term_field}

{featured_image} is meant for post context.

Note: {post_title} auto retrieves the category title because we have additional logic and make it the same as the Post Title element.

Regards,
Jenn

Hi Jenn,
thanks for this. I wasn’t trying to get images in for terms though. But this tags are great to know about.

What would be great is to have a dynamic tag that retrieves the featured_image only if is set, because getting just whatever featured images is close cause the problem I’m facing and maybe other problems. Could be named {featured_image:isset}