Re: if page.id == "pageidhere" ?

How to display content only if a specific page id is met?

mfk
Shopify Partner
2 0 1

How do i show content if the pageid matches the conditions.

For example ive tried the following :

{% if page.id == "258384388" %}
Show Content
{% endif %}

{% if page.id contains "258384388" %}
Show Content
{% endif %}

{% if id == "258384388" %}
Show Content
{% endif %}

{% if id contains "258384388" %}
Show Content
{% endif %}

 

But still cant get it to work? I could probably also use page.handle but if the client changes the page title and/or handle, then it would mess everything up. Whereas the id wouldnt change regardless

Replies 3 (3)

what_ever
Excursionist
15 0 4

{% if page.id == 49700733008 %}
Show Content
{% endif %}

 

For anyone else looking for this.

astianax
Shopify Partner
2 0 0

Thanks mate !

Robbie3
Excursionist
38 1 32

I was able to prevent a popup for a landing page by using this code on my theme.liquid...

Find: 

{%- sections 'popup-group' -%}

Replace with:
{%- if page.title != "Enter Page Title" -%}
{%- sections 'popup-group' -%}
{%- endif} -%}