Archived topic
Different header image for each of my two categories
21 replies · Started by Christian on March 14, 2021
Hello
I put two categories in my menu but suddenly I don't have a header image for these pages.
I want to assign a different header image for each of my two categories on my site. I believe that I need to define a new element but I did not understand what type of element to choose for it and what adjustment made despite consulting the documentation.
Thank you for telling me.
Hi Christian,
Since WordPress doesn't allow a featured image in category archives, you will need to create 2 separate header element and use a custom image as background image option for each:
https://docs.generatepress.com/article/how-to-create-a-page-hero/#step-2-choose-a-background
Let me know if this helps :)
You are right: the type of element could only be "header" Unfortunately I created an element "header" for my "Anecdotes" category by copying the settings of element "home hero" and nothing is displayed.
The page is here
Did you make sure to add those pages to the exclusion rule of the original header element?
https://docs.generatepress.com/article/conflicting-display-rules/
I added exclusions in the Site hero element and it did indeed change the display but my image still does not show for the "Anecdotes" category.
Thanks for your help.
Hi there,
can you provide a screenshot of your Elements list ?
Are you wanting the Hero on the Category Archive ?
I don't know how to answer your question. I have put in my menu as you can see on my first screenshot two categories. Here I did what I was told for the "Anecdotes" category. I would do it as soon as I understood also for the "Actualité" category. I would like this place to display the personalized image that I put in the "Header Anecdotes" element.
https://www.screencast.com/t/PJRwH7bj
Here is what I have elsewhere on my site that I would also like for the "Anecdotes" page.
Ok - so to display the header element there the Display Rule Location has to be:
Post Category Archive > Your Category
So it looks like the header element is working.
Did you add a featured image, content and padding to the page hero tab ?
This is what I get and it is not yet brilliant. The name of the category is not on the image but below. The navigation does not appear since it should be on the image and its text is white.
Hi there,
If I may suggest:
I believe this was asked before last year.
As Leo mentioned, by default categories don't have features image but we can actually do this by adding custom fields holding image values for our categories.
Here's a few example solutions:
https://generatepress.com/forums/topic/adding-custom-images-as-header-background-for-categories/
https://generatepress.com/forums/topic/how-do-i-get-the-header-on-the-category-pages/#post-1440100
This way, you don't have to create a Header Element for each category just to add unique images as these solutions are dynamic. All you have to do is to set the image on the custom field for images in your categories.
It mainly involves the use of ACF plugin.
Thank you very much. But there clearly I do not understand anything. Much too technical for me.
It seems complicated enough to me not to start from scratch with a new solution.