Shopify themes, liquid, logos, and UX
Hi,
I would like to only display the announcement bar on my home page: https://houseofpapaya.com/
I am using the broadcast theme and I have tried what was suggested here: https://community.shopify.com/c/shopify-design/make-announcement-bar-to-be-visible-only-on-homepage/...
but it isn't working. I also don't have the words announcement in my theme liquid
Hello @Lola
You can add code by following these steps
1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. Paste the below code before </body> on theme.liquid
{% if template == 'index' %}
<style>
.announcement-bar {
display: block !important;
}
</style>
{% endif %}
<style>
.announcement-bar {
display: none !important;
}
</style>
my reply helpful? Click Like to let me know!
your question answered? Mark it as an Accepted Solution.
this does not work 🙂
Hi i do not have this option 🙂
Hi @Lola
Would you mind sharing your store URL? Thanks!
Yes sorry the domain name hasn't been transfered yet https://22d12c-6a.myshopify.com/?_ab=0&_fd=0&_sc=1
It okay, preview can work with password. Thanks!
https://s2gis5hvsukusrge-81747378511.shopifypreview.com
here is a shareable link that works for two days
Thanks for the info, check this one.
From your Shopify admin dashboard, click on "Online Store" and then "Themes"
Find the theme that you want to edit and click on "Actions" and then "Edit code".
In the "theme. Liquid" file. Find the </body> tag and paste the code below before the tag.
{% if template.name == 'index' %}
<style>
.announcement-bar {
display: block;
}
</style>
{% else %}
<style>
.announcement-bar {
display: none;
}
</style>
{% endif %}
And Save.
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Hi,
There is no </body> but I've found one body mentioned:
</head>
<body id="{{ page_title | handle }}" class="template-{{ template.name | handle }} grid-{{ settings.grid_style }}{% if customer %} customer-logged-in{% endif %}{% if settings.animations_enable %} aos-initialized{% endif %}{% if settings.product_grid_outline %} has-line-design{% endif %}" data-animations="{{ settings.animations_enable }}">
{%- render 'loading' -%}
<a class="in-page-link visually-hidden skip-link" data-skip-content href="#MainContent">{{ 'general.accessibility.skip_to_content' | t }}</a>
<div class="container" data-site-container>
<div class="header-sections">
{% sections 'group-header' %}
</div>
{% sections 'group-overlay' %}
<!-- CONTENT -->
<main role="main" id="MainContent" class="main-content">
{{ content_for_layout }}
</main>
</div>
I've tried copying your code between </head>
and <body but it didn't work
That wont be possible without the </body> every sinle store have.
This tag is on the very end of the code in your theme.liquid.
This where you paste the code. MAke some space first.
And this should be look like.
And Save.
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024