Advertisement
Guest User

accordion

a guest
Nov 23rd, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1.  
  2. // using taxonomy
  3.  
  4. function accordion_list_shortcode($atts){
  5. extract( shortcode_atts( array(
  6. 'category' => '',
  7. 'count' => '5',
  8. 'btncolor' => 'primary',
  9. ), $atts, 'wishlist' ) );
  10.  
  11. $q = new WP_Query(
  12. array('posts_per_page' => $count, 'post_type' => 'accordion_bar', 'accordion_category' => $category)
  13. );
  14.  
  15.  
  16. $list = '<div id="accordion" class="panel-group">'; // wrapper will go here
  17. while($q->have_posts()) : $q->the_post();
  18. $idd = get_the_ID();
  19. $list .= '
  20. <div class="panel panel-default">
  21. <div class="panel-heading">
  22. <h4 class="panel-title">
  23. <a href="#collapseOne" data-parent="#accordion" data-toggle="collapse" class="collapsed">
  24. '.get_the_title().'
  25. </a>
  26. </h4>
  27. </div>
  28. <div class="panel-collapse collapse" id="collapseOne" style="height: 0px;">
  29. <div class="panel-body">
  30. <p>'.get_the_content().'</p>
  31. </div>
  32. </div>
  33. </div>
  34. ';
  35. endwhile;
  36. $list.= '</div>';
  37. wp_reset_query();
  38. return $list;
  39. }
  40. add_shortcode('accordion_list', 'accordion_list_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement