Shortcode - nested shortcode, multiple inner

If I understand you correctly, you cannot define “which inner” shortcode you want to address. .Inner is always the whole content. In this case both inner shortcodes.

I had a similar problem and solved it like this. Put something like this in the shortcode that comes first (I assume the order will not change, so in your case jumbo_intro), this should be the very last thing of the file:

--break-me-here--

Then in your jumbo shortcode, you break the .Inner content into an array and pull the right thing in the right place:

{{- $children := split .Inner "--break-me-here--" -}}
<div class="jumbotron jumbotron-fluid">
  <div class="container">
    <div class="row">
      <div class="col-6">
          {{- index $children 0 | safeHTML -}}
      </div>
      <div class="col-5 offset-1">
         {{- index $children 1 | safeHTML -}}
      </div>
    </div>
  </div>
</div>

3 Likes