Posted By

ricosushi on 10/13/10


Tagged

shortcode wrodpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ricosushi
laurentzziu


wp shortcode


 / Published in: PHP
 

  1. // without attributes
  2. function one_half($atts, $content=null){
  3. return '<div class="one-half">'.do_shortcode($content).'</div>';
  4. }
  5.  
  6. add_shortcode('one_half', 'one_half');
  7.  
  8.  
  9. // attributes
  10. function toggle($atts, $content=null){
  11.  
  12. extract(shortcode_atts( array(
  13. 'title' => 'ITEM'
  14. ), $atts ));
  15.  
  16. return '<h5 class="toggle-trigger custom"><a href="#">'.$title.'</a></h5>
  17. <div class="toggle-container">
  18. <div class="block">
  19. <p>'.do_shortcode($content).'</p>
  20. </div>
  21. </div>';
  22. }
  23. add_shortcode('toggle', 'toggle');

Report this snippet  

You need to login to post a comment.