Hide/showe a div with condition

Hi, I have an element (Div) in a header which I only want to show on single CPT pages. To be more specific, it’s a button with a link back to the CPT archive page and it would be strange to show that button on the archive page itself (as on any other page in my case).

Right now I’m trying to achieve this with a global header and a condition on the element I want to show only on the single post type pages. Can’t figure out what the condition should be, or if this is even possible. Archive page is: https://demo.bierkaart.online/bier/

I also tried making a second header with the back button, but then I couldn’t figure out how to assign it to all (and only) single CPT pages. It feels like I’m missing something quite obvious…

Hey @arnoldmeulenbeld,

Regretfully, we don’t have Element conditions for archives yet. It’s maybe because it was primarily designed for content. What we do have is Header/Footer Assignment Conditions for Single and Archive pages.

With that said, you’ll need to create 2 headers. 1 for your CPT archive and another for your single CPT.

For single, select Post Type from the Single section like this

image

The setup is similar for Archives.

image

You just need to select your CPT for both cases.

image

Hope that helps.

Yep, that did it. Thank you very much. Somehow I was running in circles :upside_down_face:

HI @arnoldmeulenbeld,

You’re welcome and it’s our pleasure to help you. If you have any other concerns regarding our theme features, feel free to reach us.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.