skip to Main Content

There is a fb pixel still imbedded in the header of my shopify store. using the facebook pixel helper it says I still have a fb pixel in my header. I looked into it and saw it is in my {{ content_for_header }}.

I have tried .remove() and | remove: and I still have the fb pixel in the header of my theme.liquid

2

Answers


  1. You can remove or replace strings like below

    Replace

    {{ content_for_header | replace: 'string to be replaced', 'inserted' }}
    

    To remove

    {{ content_for_header | remove: '' }}
    

    Otherwise you can’t really edit {{ content_for_header }}

    Login or Signup to reply.
  2. You can’t use replace or remove filter on content_for_header

    It’s not recommended to modify the content_for_header but, I will show you how to modify it.

    First, comment it

    {%- comment -%}
      {{ content_for_header }}
    {%- endcomment -%}
    

    This will let you update the file with theme watch

    Second, Use capture for custom content_for_header

    {% capture custom_content_for_header %}
        {{ content_for_header | replace: 'your-text-to-be-replaced', 'new-text'
    {% endcapture %}
    

    Last, print your custom content for header

     {{ custom_content_for_header }}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search