Line break in product title - brookyln theme

Solved

Line break in product title - brookyln theme

jakemattingley
Tourist
9 0 1

Hey There

 

Im trying to create line breaks for my product title.  

Screen Shot 2022-08-11 at 1.24.45 PM.pngScreen Shot 2022-08-11 at 1.24.57 PM.png

 

This is what it looks like now.  Ideally I would like it to read like this:

 

doodles tee

vintage black

$46

 

thank you. 

 

www.visionboredclothing.com

Jake Mattingley
Accepted Solutions (3)

Kani
Shopify Partner
468 125 228

This is an accepted solution.

Hi @jakemattingley 

 

you can break your title with this code. ( if they all connect via ' - '

 

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

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂

View solution in original post

Kani
Shopify Partner
468 125 228

This is an accepted solution.

@jakemattingley 

1: Online store > themes > Actions > Edit code > Sections > product-template.liquid

2: find the class name 'product-single__title', if you have not edited code before then its in line 131

Kani_0-1660270153499.png

demo ( you can edit base on it

{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
     {% if forloop.index == 1 %}
           <h1 class="product-single__title" itemprop="name">
                {{ product_title_item }}
          </h1>
     {% else %}
           <p>{{ product_title_item }}</p>
     {% endif %}
{% endfor %}

Kani_1-1660270591708.png

Kani_3-1660270650465.png

 

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂

View solution in original post

Kani
Shopify Partner
468 125 228

This is an accepted solution.

code coming~~~~~🤣

1: Online store > themes > Actions > Edit code > Snippets > product-grid-item.liquid

 

Kani_0-1660287010553.png

{% assign grid_product_title_arr = product.title | split: " - " %}
{% for grid_product_title_item in grid_product_title_arr %}
     <span class="grid-product__title" style="display:block">
         {{ grid_product_title_item }}
     </span>
{% endfor %}

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂

View solution in original post

Replies 5 (5)

Kani
Shopify Partner
468 125 228

This is an accepted solution.

Hi @jakemattingley 

 

you can break your title with this code. ( if they all connect via ' - '

 

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

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂
jakemattingley
Tourist
9 0 1
Perfect I will try this. Can you tell me where exactly to insert this code?

Thank you
Jake Mattingley
Kani
Shopify Partner
468 125 228

This is an accepted solution.

@jakemattingley 

1: Online store > themes > Actions > Edit code > Sections > product-template.liquid

2: find the class name 'product-single__title', if you have not edited code before then its in line 131

Kani_0-1660270153499.png

demo ( you can edit base on it

{% assign product_title_arr = product.title | split: " - " %}
{% for product_title_item in product_title_arr %}
     {% if forloop.index == 1 %}
           <h1 class="product-single__title" itemprop="name">
                {{ product_title_item }}
          </h1>
     {% else %}
           <p>{{ product_title_item }}</p>
     {% endif %}
{% endfor %}

Kani_1-1660270591708.png

Kani_3-1660270650465.png

 

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂
jakemattingley
Tourist
9 0 1

Hey!  This worked for my product pages, which is fantastic. 

But, its still displaying with " - " on collections pages.

 

any fix for that?Screen Shot 2022-08-11 at 10.36.06 PM.pngScreen Shot 2022-08-11 at 10.36.17 PM.png

Jake Mattingley
Kani
Shopify Partner
468 125 228

This is an accepted solution.

code coming~~~~~🤣

1: Online store > themes > Actions > Edit code > Snippets > product-grid-item.liquid

 

Kani_0-1660287010553.png

{% assign grid_product_title_arr = product.title | split: " - " %}
{% for grid_product_title_item in grid_product_title_arr %}
     <span class="grid-product__title" style="display:block">
         {{ grid_product_title_item }}
     </span>
{% endfor %}

 

Hey!! ʕ ᵔᴥᵔ ʔ
Please click 'Like' and ' Accept as Solution' to encourage me to continue sharing my expertise. ♡
If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response. 🙂