Im trying to add a music player feature to my shopify store but I only want it to show up one page

Im trying to add a music player feature to my shopify store but I only want it to show up one page

yayamusic2270
Visitor
1 0 0

I'm using this music widget on my shopify and received a code to edit the theme liquid. I only want the widget to appear on one specific page. I used {% if template.name == 'page'%} "insert widget code here" {% endif %} but the widget shows up on all pages and interferes with the experience. Am I able to specify which page name it shows up on. Please let me know. Thank you!

Replies 2 (2)

saim007
Shopify Partner
611 75 107

Hi @yayamusic2270 , you can use below code


{% if page.handle contains "music-page-url" %}

"insert widget code"

{% endif %}

 

if above code is not work then you can use this -

{% if page.handle == "music-page-url" %}

"insert widget code"

{% endif %}

 

Thanks

Saim | Shopify Partner Expert

Was I helpful?

Buy me a Coffee

🙂
Hire me   to unlock the full potential of your e-commerce store 🙂

Cedcommerce
Shopify Partner
718 77 116

Hello @yayamusic2270,

 

That’s a great idea; allow us to help you achieve this.  Here is the solution you are looking for. 

We are providing the correct code for your help. Please use this and see if it works.

 

{% if page.title=="music-page-title" %}

add Code here (widget)

{%endif%}

{% if page.handle contains "music-page-url" %}

add code here (widget)

{% endif %}

{% if page.handle == "music-page-url" %}

Add code here (widget)

{% endif %}

 

Let us know if you need more help with this. 

 

Regards, 

CedCommerce 

CedCommerce || Shopify Expert
- Let us know if our reply is helpful for you. Like it.
- Was your question answered? Mark it as an accepted solution.
- For further discussion contact: Email ID- apps@cedcommerce.com
- Whatsapp:- Join Here