Shopify themes, liquid, logos, and UX
how do i edit product page only whenever i remove header from product page it get removed from home page also i want to remove this custom liquid from products pages but when i do it gets removed from home page also help please
Hi,
Headers are rendered in theme.liquid, which means they will be generated for every page, and removing them means removing them globally.
So you must only add the remove header code if it is the product page. You can use the following logic to know the product page:
//Inside <style>
{% if template contains 'product' %}
//your code to remove header
{% endif %}
where to add this code
Go to main-product.liquid file and go to bottom of the page.
If you see style section which is indicated by <style> or <style type="type/css">, add above code inside it
If you don't see style section add following code at the bottom of the main-product.liquid file
<style type="type/css">
{% if template contains 'product' %}
header {
display: none;
}
{% endif %}
</style>
OR post your preview link so that I can see the code
Hi @Hoppop
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 == 'product' %}
<style>
/* place the css style here */
</style>
{% endif %}
And Save.
Refresh the browser.
This code means it will apply the css style only in the product page.
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
didnt worked
oh, what theme your using?
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