title: Trying to insert content before 2nd h2 tag
body: <p>I am trying to insert a shortcode [toc] but i am doing something wrong, because doesnt work.</p>
  
  <ul>
  <li>I tried <code>$new_content .= do_shortcode ('[toc]');</code> WHITE page</li>
  <li>I tried <code>$new_content .= '[toc]';</code> WHITE page</li>
  <li>If i put <code>$new_content .= '&lt;span&gt;gg&lt;/span&gt;';</code> IT WORKS.</li>
  </ul>
  
  <p>The plugin is easy table of contents</p>
  
  <p>I am using this code in funstions.php</p>
  
  <pre><code>function insert_ad_in_content($content)
  {
      if ((!is_singular('post')) || (strpos($content, '&lt;h2') === FALSE) ) {  return $content; }
  
      $ChapterCount = 2; // Enter the chapter number, which you'd like an add in front of
  
      $content = explode("&lt;h2", $content);
  
      $new_content = '';
  
      for ($i = 0; $i &lt; count($content); $i++) {
          if ($i == $ChapterCount) {
              $new_content .= do_shortcode('[toc]');
          }
  
          if($i&gt;0) {
            $new_content.= "&lt;h2".$content[$i];
          } else {
            $new_content.= $content[$i];
          }
      }
  
      return $new_content;
  }
  add_filter('the_content', 'insert_ad_in_content');
  </code></pre>