Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function accordion_list_shortcode($atts){
- extract( shortcode_atts( array(
- 'category' => '',
- ), $atts, 'accordion-content' ) );
- $q = new WP_Query(
- array('posts_per_page' => '5', 'post_type' => 'accordion_items', 'accordion_category' => $category)
- );
- $list = '<dl class="accordion toggles">';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $list .= '
- <dt class="accordion-trigger"><i class="fa fa-facebook"></i>'.get_the_title().'</dt>
- <dd class="accordion-content">
- <p>'.get_the_content().'</p>
- </dd>
- ';
- endwhile;
- $list.= '</dl>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('accordion_list', 'accordion_list_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement