Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Wordpress skips parsing of shortcode WordPress

  • SOLVED

Hi,

While building a theme i came across the following problem :)

I use the following shortcodes to generate a slideshow.


function r2_carousel( $atts, $content = null ) {
return '<ul id="carousel"><li><ul>' .do_shortcode($content). '</ul></li></ul>';
}
add_shortcode('carousel', 'r2_carousel');

function r2_carousel_slide( $atts, $content = null ) {
extract(shortcode_atts(array(
'title' => ''
), $atts));

return '<li class="slide"><h1>' .$title. '</h1><p>' .do_shortcode($content). '</p></li>';
}
add_shortcode('slide', 'r2_carousel_slide');


It works up until the parsing of the second slide:

<strong>Input</strong>

[carousel]
[slide title="Using talent: Analyse 1"]Onze experts analyseren uw recruitment proces en organisatie om knelpunten te identificeren.[/slide]
[slide title="Using talen"]ces en organisatie om knelpunten te identificeren.[/slide]
[slide title="Using talent: Analyse 1"]Onze experts analyseren uw recruitment proces en organisatie om knelpunten te identificeren.[/slide]
[/carousel]


<strong>Output</strong>

<ul id="carousel"><li><ul>
<li class="slide"><h1>Using talent: Analyse 1</h1><p>Onze experts analyseren uw recruitment proces en organisatie om knelpunten te identificeren.</p></li>

[slide title="Using talen"]ces en organisatie om knelpunten te identificeren.[/slide]

<li class="slide"><h1>Using talent: Analyse 1</h1><p>Onze experts analyseren uw recruitment proces en organisatie om knelpunten te identificeren.</p></li></ul></li></ul>


It just skips the second "slide" shortcode and continues as normal afterwards.

I'm running wordpress 3.0.1 without any plugins.

Thanks in advance.

Kind regards,
Lars

Answers (1)

2010-10-08

Pippin Williamson answers:

Add this to your functions.php:


add_filter('the_content', 'do_shortcode');


That will make wordpress parse shortcodes that are within shortcodes