Liquid, Javascript
I want to add an external iframe to my home page but the custom HTML section does not appear in the new section. How do I create it and then what should I do to add the inframe?
To use our iframe you need to include some javascript on your website. This can be added in your <head> or just before the closing </body> tag.
<script src="https://tuning-shop.com/media/js/iframe-loader.js"></script>
After you have added the above to your website you can start including the iframe using the following code:
<iframe src="https://tuning-shop.com/iframe/iframe.php?user=*******" width="100%" height="auto" scrolling="no" frameborder="0" style="border: 0;"></iframe>
Hello! David
I understand that you want to add an external iframe to your Shopify homepage and that you mentioned a correction regarding the section name. No worries, Shopify offers a section called "Custom Liquid", which allows you to add custom code, including HTML, Liquid, CSS, and JavaScript. This is perfect for adding your iframe. I'll guide you step by step to do it correctly.
Since the "Custom HTML" option isn’t showing up when you try to add a new section, we’ll create one from scratch in your theme’s code. Here’s how
Create a New Section:
Add the Section Code:
<div class="custom-iframe">
{{ section.settings.custom_html }}
</div>
{% schema %}
{
"name": "Custom Iframe",
"settings": [
{
"type": "html",
"id": "custom_html",
"label": "Custom HTML"
}
],
"presets": [
{
"name": "Custom Iframe",
"category": "Advanced"
}
]
}
{% endschema %}
Add the Section to Your Home Page:
Now that you have a custom section, let’s include the JavaScript and the iframe code as per the instructions you provided.
Add the JavaScript to Your Theme:
<script src="https://tuning-shop.com/media/js/iframe-loader.js"></script>
Add the Iframe to the Custom Section:
<iframe src="https://tuning-shop.com/iframe/iframe.php?user=*******" width="100%" height="auto" scrolling="no" frameborder="0" style="border: 0;"></iframe>
You’ve now created a custom section and added the external iframe to your Shopify home page, complete with the necessary JavaScript. It should be working smoothly now. If you run into any issues or need further help, just let me know—I’m here to assist!
Best regards!
Descubre cómo expandir tus operaciones a nivel internacional con la ruta de aprendizaje...
By Shopify Feb 7, 2025Expande tus operaciones a la venta mayorista con la ruta de aprendizaje de Shopify Acad...
By Shopify Feb 3, 2025¿Alguna vez has creado una colección y has tenido problemas para añadir tus productos a...
By Ann Sep 10, 2024