title: WP: Advanced Custom Fields. Flexible Content + Repeater Fields. Using Custom fields in inline CSS
body: <p>I am trying to style a H4 element with a left and bottom border of varying widths and a specific colour which is defined by a custom field that the client would fill in the CMS. My CMS layout is correct but the code below I know not to be. My problem area is specifically with the H4, the other parts of the code are rendering correctly. </p>
  
  <pre><code>&lt;?php               
  if (get_field("sponsorlogos")){
    while (has_sub_field("sponsorlogos")){
  
      if (get_row_layout() == "sponsor_category_title"){ // Sponsor Category Title
        echo '&lt;h4 style="border-left: 10px solid '.the_sub_field('sponsor_category_title_colour').' !important; border-bottom: 1px solid '.the_sub_field("sponsor_category_title_colour").' !important; margin: 40px 0 15px 0;"&gt;';
          the_sub_field("sponsor_category_title_text");  
        echo '&lt;/h4&gt;';
      }  
  
      if (get_row_layout() == "sponsor_logo_container"){ // Sponsor Repeater Field
        $rows = get_sub_field('sponsor_item'); 
        if ($rows){ 
          echo '&lt;ul id="sponsor-logo-container"&gt;';
          foreach($rows as $row){
            echo '&lt;li class="sponsor-logo"&gt;&lt;a class="logo-link" target="_blank" href="'.$row['sponsor_link'].'"&gt;&lt;img width="190" height="110" src="'.$row['sponsor_logo'].'" alt="'.$row['sponsor_title'].'"class="logo-image grayscale" /&gt;&lt;/a&gt;&lt;span class="staff-name"&gt;'.$row['sponsor_support'].'&lt;/span&gt;&lt;/li&gt;'; 
          }
          echo '&lt;div style="clear:both;"&gt;&lt;/div&gt;';
          echo '&lt;/ul&gt;';
        }
      } 
    }
  }
  ?&gt;
  </code></pre>
  
  <p>The resulting markup is as follows:</p>
  
  <pre><code>&lt;h4 style="border-left: 10px solid  !important; border-bottom: 1px solid  !important; margin: 40px 0 15px 0;"&gt;Bronze&lt;/h4&gt;
  </code></pre>
  
  <p>You can see it omits the hex '#xxxxxx' colour part.</p>
  
  <p>I should reiterate though, as the colour hex is successfully spat out twice in the markup (as expected) but it appears above the H4 element.</p>
  
  <p>Im sure I'm not using the Advanced Custom Field tags correctly.</p>
  
  <p>Help! </p>