DAWN THEME - Image-Banner section - How to create line breaks for subtitle text block

I saw a post earlier from August 11th on how to create line breaks for the product title, for Brooklyn Theme where

you can break the title via ’ - ’

{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
{{ product_title_item }}
{% endfor %}

I would like to do the same but for the Image-Banner section, and subtitle text block for the Dawn theme. How do I do this?

Thanks.

@Kani

Hi @Smiley1311

Thanks for your invitation :slightly_smiling_face:

1: Online store > themes > Actions > Edit code > Sections > image-banner.liquid

heading

## 
     {% assign block_heading_arr = block.settings.heading | split: " - " %}
     {% for block_heading_item in block_heading_arr %}
          {{ block_heading_item | escape }}
     {% endfor %}

text


     {% assign block_text_arr = block.settings.text | split: " - " %}
     {% for block_text_item in block_text_arr %}
         {{ block_text_item | escape }}
     {% endfor %}

4 Likes

@Kani Thank you very much and for your quick reply. ( I tried to do a solution myself but didn’t have it quite in the right place. I will analyze your code and learn from it! Thank you.)

1 Like

Great! :clinking_beer_mugs:

This solution worked perfectly, it took me a minute to figure out I needed to put " - " where I wanted a line break. Thanks!

Hi @Kani - I’m using Craft 9.0 and I can’t get this solution to work. I’m trying to add line breaks in the image banner subtitle. Can you please break it down in more detail? Thank you!

This was good, i modified it in two ways though. For those who dont realize how it works, you need to type " - " (without quotation marks). I changed the - to # since thats likely less used typing. Also I made it insert a paragraph break rather than what was the equalivalent of a line break. If anyone uses my version, be sure to change the - to # in the first block of code.

{%- when 'text' -%}
  
    {% assign block_text_arr = block.settings.text | split: "#" %}
    {% for block_text_item in block_text_arr %}
      

{{ block_text_item | escape }}

     {% endfor %}