Kelly B
Kelly B

Reputation: 1

Shopify Theme Development - Section and Block development

Hello Shopify Theme Development Pros,

I am trying to add a block in a section of my theme and although the input block shows up on the screen, when I input type nothing shows up on the actual website. I have tried defining styles in CSS as well, but no luck.

This is what I have added to the block settings in the liquid file...

    {
        "type": "text",
        "id": "review_title",
        "label": "Review Heading",
        "default": "Enter title here"
    },

And this is the html that I added...

        <div class="testimonial-heading> {% if section.settings.review_title != blank %} <p> {{ section.settings.review_title | escape }} </p> {% endif %}</div>

Upvotes: 0

Views: 442

Answers (1)

drip
drip

Reputation: 12943

When you are using blocks you need to loop them since there are dynamic content that can be added multiply times.

So at the moment you are targeting the settings object and not the blocks section.settings.review_title.

In order to list the blocks you need to do the following:

{% for block in section.blocks %}
    <div class="testimonial-heading"> 
        {% if block.settings.review_title != blank %} 
            <p> {{ block.settings.review_title | escape }} </p> 
        {% endif %}
    </div>
{% endfor %}

Upvotes: 0

Related Questions