I am developing a wp theme and I want to have a shortcode that can be used serveral times from within an article.
in functions.php i have:
function twoColPostcardfn($atts, $content){
extract(shortcode_atts(array(
'image'=>'',
'text'=>'',
'title'=>'',
'boxlink'=>'',
'float'=>''
), $atts));
$bob='<span class="twoColPostcard ">'.$content.'</span>';
return $bob;
}
add_shortcode( 'twoColPostcard', 'twoColPostcardfn' );
in the article I have:
<p>[twoColPostcard]</p>
<p>hello from the first postcard</p>
<p>[/twoColPostcard]</p>
<p>[twoColPostcard]</p>
<p>hello from the second postcard</p>
<p>[/twoColPostcard]</p>
And I want my output to be
<span class="twoColPostcard"><p>Hello from ...</p></span>
<span class="twoColPostcard"><p>Hello from ...</p></span>
But instead I am getting:
<span class="twoColPostcard">
<p></p>
<p>hello from the first postcard</p>
<p><span class="twoColPostcard "></span></p>
<p>hello from the second postcard</p>
<p></p>
</span>
In other words the second shortcode is begun before the first one is finished so the are ending up nested (and the 2nd one is empty)
I used the codex to help but its not working and I don't know why. I have tried inserting this into my functions as per to no avail
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);