jQuery accordions and Wordpress Shortcode -


i'm trying jquery accordion/tab shortcode this

[accordions] [accordion title="accordion 1"]accordion 1 content[/accordion] [accordion title="accordion 2"]accordion 2 content[/accordion] [accordion title="accordion 3"]accordion 3 content[/accordion] [/accordions] 

i've tried many ways cant seem work

how can done?

i haven't tested code, should work:

function accordian_open_tag( $atts, $content='' ) {   return '<div class="accordion">{$content}</div>'; } function accordian_section( $atts, $content='' ) {   $atts = shortcode_atts( array(     'title' => 'default title'   ), $atts );    return "<h3><a href=\"#\">{$atts['title']}</a></h3>" .           "<div>{$content}</div>"; } add_shortcode( 'accordians', 'accordian_open_tag' ); add_shortcode( 'accordian', 'accordian_section' ); 

you need run $(".accordian").accordian() when page loaded work.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -