• Resolved drazon

    (@drazon)


    Hello I wanted to ask if
    [my_shortcode 'car', 'wheel','text3', ... 'textn'] [/my_shortcode] is possible to give an output like this with ‘n’ number of args.
    `<span class=”myclass”>car</span>
    <span class=”myclass”>wheel</span>
    <span class=”myclass”>text3</span>`
    …..
    …..
    <span class="myclass">textn</span>
    So far I have done this:
    [my_shortcode]car,wheel,text3,text4,....,textn[/my_shortcode]

    add_shortcode('my_shortcode', 'my_shortcode_function' );
    function my_shortcode_function($atts, $content ) {
        return '<span class="myclass">'.$content.'</span>';
    }

    but of course the output is:
    <span class="myclass">car,wheel,text3,text4,....,textn</span>

    Can you help me?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode with unknown number of imputs?’ is closed to new replies.