Hi!
can´t seem to fix it. Already watched the other question about it but after 3 hours im giving up. I want to remove the metafields when they are blank. Thanks for any help!
Hi!
can´t seem to fix it. Already watched the other question about it but after 3 hours im giving up. I want to remove the metafields when they are blank. Thanks for any help!
Hello @NewSkinOrder23
You can make modifications to the theme’s code Here is a step-by-step guide:
Online Store > Themes
Click the “Actions” button, then select "Edit code.
You’ll need to locate the code that displays the metafields and add a condition to check if they are blank before rendering them. Follow these steps:
Under “Sections,” click on “article-template.liquid” to open the blog post template file.
The section of code that displays the metafields. It might look something like this.
{% if article.metafields.your_metafield_key %}
{{ article.metafields.your_metafield_key }}
{% endif %}
Here’s an example:
{% if article.metafields.your_metafield_key | blank? != true %}
{{ article.metafields.your_metafield_key }}
{% endif %}
This code checks if your_metafield_key metafield is not blank before displaying it.
Repeat the above steps for any other metafields that you want to remove when they are blank.
Save the changes to the file.
After saving the changes, the metafields that are blank should no longer be displayed in your Shopify Symmetry theme.
The specific implementation may vary depending on the structure and customization of your theme.
The above steps are a general guide, and the actual code and file names may be different in your theme.
Thanks for the reply! I just cant seem to find where that code is located…
I dont have article-template, and for some reason i cant send screenshots because png or jpg is not supported?
Hello @NewSkinOrder23
you may need to locate and modify the relevant code in a different file. Here’s an alternative approach:
Hello @NewSkinOrder23
Try for the “featured-blog.liquid”