Site logo

Archived topic

category page & featured image

21 replies · Started by Ernst Wilhelm on March 24, 2020

Viewing posts 1–15 of 22

How can achieve I it to display a category page together with a featured image in a simple way?

Cheers

Hi there,

Category pages don't have featured images by default so:

1. Install this plugin:

https://wordpress.org/plugins/categories-images/

2. Create a New Hook Element.
https://docs.generatepress.com/article/hooks-element-overview/

2.1 Add this to the Hook content:
<?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>

2.2 Select the Hook to position it e.g
after_archive_title

2.3 Check Execute PHP
2.4 Set Display Rules to: Post Category Archive

Can you add a simple line of HTML to the Hook e.g

<span>Hook is working</span>

If that displays then we know the Hook config is correct.

Can you add a simple line of HTML to the Hook e.g

<span>Hook is working</span>

If that displays then we know the Hook config is correct.

Thanks. I found the error in config. I was a bit confused, because I could assign an image in the category config.

Thanks for your help.

Glad to hear that

Hi,
I've tried with dispatch theme and it's not working.
May be it is necessary to make more changes with this theme?
Thanks
Jose

Hi there,

Dispatch uses a Header Element for the archive pages.
You would need to either:

1. Delete the Header Element in Appearance > Elements --> Archives Header

OR

2. In the above instructions change:

elect the Hook to position it e.g after_archive_title to after_header

Now it's working.
Thank´s

You're welcome

What would be the way forward if I want the hero background / the header element use this category featured image as a background?

Hi - not to bring this whole thread back, but I'm having issues here. The category featured image is displayed correctly, but it's not showing up in the <og:image> or any other meta tags, so posting it on social etc. doesn't work.

Example: https://www.raptorsrepublic.com/category/canada-basketball/

Any ideas on how to resolve this?

This archived topic is closed to new replies.