Jquery toggle content Shortcode

Public

Jquery toggle content Shortcode

</> CopyGet raw version
php
  1. /*============================================================================================*/
  2. /* Jquery toggle content Shortcode
  3. /*============================================================================================*/
  4. function glossy_helper_tags_toggle( $attrs, $text = null ) {
  5. extract(shortcode_attrs(array(
  6. 'title' => '',
  7. //'type' => '',
  8. 'color' => '',
  9. //'default' => '',
  10. 'status' => '',
  11. 'class' => '',
  12. 'item_last' => 'false',
  13. ), $attrs));
  14.  
  15. $title = ($title) ? $title : t('display the code');
  16.  
  17. //$classes = !empty($class) && !empty($class) ? explode(' ', $class) : array();
  18. $classes = !empty($class) ? explode(' ', $class) : array();
  19. $classes[] = 'toggle';
  20. //$classes[] = !empty($default) && ($default == 'open') ? 'active' : null;
  21. $classes[] = !empty($status) && ($status == 'active') ? 'active' : null;
  22. $classes[] = !empty($color) ? 'color' . '_sprite' : null;
  23.  
  24. $classes = trim(implode(' ', $classes));
  25. //$out = '<h4 class="' .$classes. '"><a href="#">' .$title. '</a></h4>';
  26. $out .= '<h4 class="'.$classes.'"><a href="#' .$title. '" name="' .$title. '" class="' .$title. '"><span class="icon toggle-icon">&nbsp;</span>' .$title. '</a></h4>';
  27. $out .= '<div class="toggle_content clearfix">';
  28. $out .= '<div class="block">';
  29. $out .= $text;
  30. $out .= '</div>';
  31. $out .= '</div>';
  32.  
  33. /*if ($type =='framed') {
  34. $out = '<div class="toggle_framed">' . $out . '</div>';*/
  35. $classes ='';
  36. if ($item_last == 'true') {
  37. $classes = 'item_last ';
  38. }
  39.  
  40. $out = '<div class="'.$classes.'block toggled_frame">'.'<div class="toggle_framed content clearfix">' .$out .'</div>' .'</div>';
  41. return $out;
  42. }
  43.  
  44.  
  45. function glossy_helper_tags_toggle_tips($format, $long) {
  46. $output = '<p>[toggle title="Your title" type="normal, framed" color="supported color name. e.g. red" default="open, close" class="additional classes"]Your Content here[/toggle]</p>';
  47. return $output;
  48. }