Lots of Googling has still not yielded a solution. Here is the problem:
I have created a custom Wordpress shortcode to use inside my Thesis theme. The goal of the shortcode is to allow users to wrap content on a page/post in Schema markup tags. My code is below:
function articlesection_rs_shortcode($atts, $content) {
$content = do_shortcode($content);
return '<span itemprop="articleSection">'.wpautop($content).'</span>';
}
add_shortcode('schema_article_section', 'articlesection_rs_shortcode');
But here is the issue. If the content between my shortcode opening/closing tags has no HTML elements, everything looks good. If, however, I have any HTML tags on inner content, the closing </span>
gets placed at the very end of my content, instead of where I placed the closing shortcode tag. Visual example:
Output when content inside shortcode is plain-text:
<span itemprop="articleSection">test content</span>
Output when content inside shortcode is HTML content:
<span itemprop="articleSection">
<h1>test content</h1>
.........
<!-- More Content Until end of page -->
</span>
I have tried using wpautop()
and wptexturize()
but no luck.
I am using Wordpress 3.8.2 and Thesis 1.8.5. Any help, advice, code, or links are much appreciated.
EDIT: Anyone have any ideas?
<h1>test content</h1>
enough? – Rarst Apr 11 '14 at 20:50