Advertisement
wpexplorer

Untitled

Jul 1st, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function toggle_shortcode( $atts, $content = null )
  2. {
  3. extract( shortcode_atts(
  4. array(
  5. 'title' => 'Click To Open',
  6. 'state' => '',
  7. ),
  8. $atts ) );
  9. $state = ( $state == 'open' ) ? 'open-toggle' : null;
  10. $active = ( $state == 'open-toggle' ) ? 'active' : null;
  11. return '<div class="toggle-wrap '. $state .'"><h3 class="trigger '. $active .'"><a href="#" title="'. __('Toggle', 'wpex') .'">'. $title .'</a></h3><div class="toggle_container">' . do_shortcode($content) . '</div></div>';
  12. }
  13. add_shortcode('toggle', 'toggle_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement