Header - Hide Div On Archive Pages But Display On Single Pages

Hi,

I have created a progress bar which I want to show on all single post pages, but I do not want it to display on the main blog page or any category pages.

As the bar needs to be attached to the header as a sticky element, I have set conditions on the bar to Post Type = Post. However, it displays on category and blog pages as well. I cannot find the right condition to make sure it does not display on blog or category pages, just on single posts. Is this possible?

2024-02-13_16-34-22

Thanks,
Christopher

Hey Christoper,

Just a fellow Pro user here, so they may have a different solution than what I can suggest, but you could just duplicate the header, so now you’d have two headers: one with the progress bar and one without. Then assign each of those headers to either the Archive pages or the Single pages/post type.

Hey @turnkeydigital,

Thanks for the suggestion. I did think of that one, but want to avoid the double header route, if I can. I am sure it can be done with Conditions, but am missing the logic for categories and blog.

I appreciate the help!
Christopher

Hello Christopher,

Thanks for writing to us.

Regretfully there is no built-in condition at the moment but I would suggest you please use this condition on your Header bar. You need to select the condition type as a number and set this condition.

{{dc:query:found_posts}} == 1

Hope it helps
Thanks

Hello @prakash_s,

Thank you. That is just what I was looking for! Just one minor difference to your screenshot:

In my case the bar does not have the == option, so I used is, which provided the result I was after.

Thank you very much,
Christopher

Hey Christopher,

We’re glad that it is now working properly on your end. For future references, to use ==, you should use a number instead of a string.

Hope that helps.

Hey @marc_a,

Thank you very much for the clarification about using Number - I missed that!

Thanks,
Christopher

You are most welcome Christopher

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