Skip to content

Instantly share code, notes, and snippets.

{% comment %}
Created by Hardik Davra,
1) Company: https://candisofttech.com
2) Shopify Blogging: https://tataglia.com/category/shopify/
{% endcomment %}
<style type="text/css">
/* css style for back to top button */
.back-to-top-button {
position: fixed;
{% schema %}
{
"name": "Custom Announcement bar",
"settings": [
{
"type": "checkbox",
"id": "show_announcement",
"label": "Show announcement",
"default": false
},
{%- if section.settings.show_announcement -%}
{%- if section.settings.home_page_only == false or template.name == 'index' -%}
<div class="announcement-bar-parent">
<p class="announcement-bar-message"></p>
</div>
{%- endif -%}
{%- endif -%}
{%- if section.settings.show_announcement -%}
{%- if section.settings.home_page_only == false or template.name == 'index' -%}
<div class="announcement-bar-parent">
{%- if section.settings.announcement_link != blank -%}
<a href="{{ section.settings.announcement_link }}" >
{%- endif -%}
<p class="announcement-bar-message">{{ section.settings.announcement_text }}</p>
"settings": [
{
"type": "checkbox",
"id": "show_announcement",
"label": "Show announcement",
"default": false
},
{
"type": "checkbox",
"id": "home_page_only",
{
"type": "color",
"id": "announcement_bar_background_color",
"label": "Background Color",
"default": "#000000"
},
{
"type": "color",
"id": "announcement_bar_text_color",
"label": "Text Color",
<style>
.announcement-bar-parent a {
text-decoration: none;
}
.announcement-bar-message {
font-size: 14px;
margin: 0px;
text-align: center;
padding: 10px 0px;
<style>
.announcement-bar-parent a {
text-decoration: none;
}
.announcement-bar-message {
font-size: 14px;
margin: 0px;
text-align: center;
padding: 10px 0px;
background-color: {{ section.settings.announcement_bar_background_color }};
<style>
html, body,
[id*='shopify-section']:not([id*='announcement']):not([id*='header']):not([id*='footer']) > [class*='background'],
[id*='shopify-section']:not([id*='announcement']):not([id*='header']):not([id*='footer']) {
background: url('replace-url') !important;
background-size: cover !important;
background-repeat: no-repeat !important;
}
</style>
{% if request.path contains 'contact' %}
<style>
html, body,
[id*='shopify-section']:not([id*='announcement']):not([id*='header']):not([id*='footer']) > [class*='background'] {
background: url('replace-url') !important;
background-size: cover !important;
background-repeat: no-repeat !important;
}
</style>
{% endif %}