Parrothead @ WP ShowHide Elements

Parrothead

I’ve been including this plugin in my themes for a while and came up with a shortcode to make it easier for my clients.

Open source contribution.

Add this to functions.php:

function Showhide($atts, $content = null){
extract( shortcode_atts( array(
‘title’ => ‘Add Title’,
), $atts ) );
$nice_title = str_replace(‘ ‘,”,$title);
$rand = rand(0,20);
$accordion = ‘‘.$title.’‘;
$accordion .= ”. do_shortcode($content) .”;
return $accordion;
}

add_shortcode(‘Showhide’,’Showhide’);

Here’s usage for the shortcode:
[Showhide title=’A really good Question?’]
With a really good answer.
[/Showhide]

Enjoy!