Hi,
Is there a way to only show affiliate banners, DIV elements, and shortcodes on pages with a certain category? If so, how?
Hi,
Is there a way to only show affiliate banners, DIV elements, and shortcodes on pages with a certain category? If so, how?
In single template…
{{ if in .Params.categories "Category A" }}
something
{{ end }}
Thank you. It works.
And how does it work with 2 categories? (e.g., Category A and Category B)
That depends on whether you want to satisfy one condition or both.
{{ if and (in .Params.categories "A") (in .Params.categories "B") }}
something
{{ end }}
{{ if or (in .Params.categories "A") (in .Params.categories "B") }}
something
{{ end }}
The second one can also be written:
{{ if intersect .Params.categories (slice "A" "B") }}
something
{{ end }}
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.