Add transparent header

//Add header.liquid

{% assign is_transparent_global = settings.global_transparent_header %}
{% assign is_homepage = false %}
{% assign is_specific_page = false %}

{% if template.name == ‘index’ %}
{% assign is_homepage = true %}
{% endif %}

{% if template.name == ‘page’ %}
{% assign transparent_pages = settings.transparent_pages | split: ‘,’ %}
{% if transparent_pages contains page.handle %}
{% assign is_specific_page = true %}
{% endif %}
{% endif %}

//Show vao header class

{% if is_transparent_global or is_homepage or is_specific_page %}transparent{% endif %}

//Setting ở file chính “settings_schema.json”
{
“name”: “Header Settings”,
“settings”: [
{
“type”: “checkbox”,
“id”: “global_transparent_header”,
“label”: “Enable Transparent Header Globally”,
“default”: false
},
{
“type”: “textarea”,
“id”: “transparent_pages”,
“label”: “Pages with Transparent Header”,
“info”: “Add page handles separated by commas (e.g., ‘about-us, contact’).”
}
]
},

Leave a Reply

Your email address will not be published. Required fields are marked *