Plugin Author
Mike
(@conjur3r)
Thanks for raising that.
I would suggest to check if the custom shortcode closes the h2 tag properly after the actual heading. TOC+ reads the text between the heading tags so make sure they are closed properly.
If the above doesn’t work, add a newline (eg echo “\n”) at the end of your headings as TOC+ shouldn’t match anything over multiple lines.
Yep, properly formed HTML. Here’s an example of the output:
<h2>My Heading</h2><div class="grid"><div><img src="example.org/spacer.gif" width="90" height="113"><p><a href="#">Some text 2</a></p><p>Even more text 2</p><p>987654321</p></div><div><img src="example.org/spacer.gif" width="90" height="113"><p><a href="#">Some text</a></p><p>Even more text</p><p>12345678</p></div></div>
Adding a new line character didn’t seem to have an effect.
Here’s what I get for output with the TOC+ plugin:
The HTML that appears in the h2 tag:
<h2><span id="My_Heading_____Some_text_2___Even_more_text_2___987654321_____Some_text___Even_more_text___12345678">My Heading</span></h2>
The HTML that appears in the #toc_list:
<ul class="toc_list">
<li><a href="#My_Heading_____Some_text_2___Even_more_text_2___987654321_____Some_text___Even_more_text___12345678">My_Heading_____Some_text_2___Even_more_text_2___987654321_____Some_text___Even_more_text___12345678</a></li>
</ul>
Plugin Author
Mike
(@conjur3r)
That’s interesting. Are you able to add a newline after the closing heading tag to see if it does the same thing?
Next up, I’m most likely going to ask for the custom php stuff sitting behind the shortcode so I can try on one of my machines. Is it another plugin you wrote or did you do it via functions.php?
My mistake–I forgot to copy the plugin file from my IDE to the website after I made the change. So, yes, adding a new line after the closing header element seems to work.
Plugin Author
Mike
(@conjur3r)
Awesome, thanks for reporting back.