2

By default in views field label it possible to put only plain text, so the markup looks like:

<div class="views-field views-field-price">
  <span class="views-label views-label-price">Price: -10%</span>
  <span class="field-content">9.99</span>
</div>

But I need to add some text wrapped with tags, like

<div class="views-field views-field-price">
  <span class="views-label views-label-price">Price: <span>-10%</span></span>
  <span class="field-content">9.99</span>
</div>

How it is possible?

1

Uncheck create label

Click on rewrite results, check mark override out and put:

  <span class="views-label views-label-price">Price: <span>-10%</span></span>
  <span class="field-content">{{ field_price }}</span>

I'm not 100% that it's {{ field_price }}, but you can click on replacement patterns to see the pattern name.

enter image description here

  • As a result, I did not have to do this task. But the advice is correct. Someone it could be useful! – Viktor Mar 31 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.