If else

LuffyDMonkey12
Visitor
1 0 0

Can anyone help me with this? I want to create an if-else state for page ID just like this one below - 

 

{% if page.id == XXXXX %}

 CSS HERE

{%else%}

CSS HERE

{% endif %}

 

But there are multiple page IDs for the first condition, how should I do it?

Replies 3 (3)
PageFly-Oliver
Trailblazer
221 56 46

Hi @LuffyDMonkey12

you can try

 

{% if page.id == XXXXX or page.id == XXXXY or page.id == XXXXZ %}

 CSS HERE

{%else%}

CSS HERE

{% endif %}

 

 

Hope my solution works perfectly for you.

Cheers!

Oliver | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.


Make your Instagram Feed a Sales Generator with VIBE Shoppable Instagram Feed.


jordanholmes
Shopify Expert
149 26 30

replied to wrong comment

Jordan Holmes
Shopify Expert and Ruby on Rails Developer
https://experts.shopify.com/jordan-holmes
jordanholmes
Shopify Expert
149 26 30

{%  assign page_ids = 'ID1,ID2,ID3' | split: ',' %}

 

{% if page_ids contains page.id %}

    .css { }

{% else %}

  .css { }

{% endif %}

Jordan Holmes
Shopify Expert and Ruby on Rails Developer
https://experts.shopify.com/jordan-holmes