Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // category support in shortcode if want to support category by shortcode then create new category for every post suppose if you want to use 4 post then make seperately 4 new category
- <div class="container">
- <div class="row">
- <div class="col-md-6">
- <div class="bootstrap_accordion">
- <?php
- $loop = new WP_Query(array('post_type' => 'accordion_bar', 'posts_per_page' =>-1));
- $count =0;
- ?>
- <?php if ( $loop ) :
- while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <?php
- $terms = get_the_terms( $post->ID, 'accordion_category' ); // name of the taxonomy
- if ( $terms && ! is_wp_error( $terms ) ) :
- $links = array();
- foreach ( $terms as $term )
- {
- $links[] = $term->name;
- }
- $links = str_replace(' ', '-', $links);
- $tax = join( " ", $links );
- else :
- $tax = '';
- endif;
- ?>
- <?php echo do_shortcode('[items category="'.strtolower($tax).'"]');?>
- <?php endwhile;?>
- <?php endif; ?>
- </div>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement