Last active
December 29, 2015 06:49
-
-
Save shazdeh/7631477 to your computer and use it in GitHub Desktop.
Accordion shortcode. It uses Builder's default output. Example:
[accordion][accordion_item title="Title 1"]Panel 1 content[/accordion_item][accordion_item title="Title 2"]Panel 2 content[/accordion_item][/accordion]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_themify_accordion_shortcode( $atts, $content = '' ) { | |
$class = isset( $atts['style'] ) ? $atts['style'] : ''; | |
$output = '<div class="module module-accordion"><ul class="ui module-accordion '. $class .'">'; | |
$output .= do_shortcode( $content ); | |
$output .= '</ul></div>'; | |
return $output; | |
} | |
add_shortcode( 'accordion', 'custom_themify_accordion_shortcode' ); | |
function custom_themify_accordion_item_shortcode( $atts, $content ) { | |
$output = '<li><div class="accordion-title"><a href="#">' . $atts['title'] . '</a></div><div class="accordion-content default-closed">'. do_shortcode( $content ) .'</div></li>'; | |
return $output; | |
} | |
add_shortcode( 'accordion_item', 'custom_themify_accordion_item_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment