Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function stock_carousel_post($atts) {
- extract( shortcode_atts( array(
- 'count' => -1 ,
- 'type' => 'page',
- 'custom_css' => '',
- ), $atts) );
- $q = new WP_Query(
- array(
- 'posts_per_page' => $count,
- 'post_type' => 'post',
- )
- );
- $list = '<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
- <div class="carousel-inner">
- ';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $post_content = get_the_excerpt();
- $list .= '<div class="carousel-item active" style="width: 100%; height: 150px; background-color: #334;">
- <div class="carousel-caption d-none d-md-block" >
- <h3>'.get_the_title().'</h3><p>'.get_the_content().'</p>
- </div>
- ';
- endwhile;
- $list.= ' </div>
- <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
- <span class="carousel-control-prev-icon" aria-hidden="true"></span>
- <span class="sr-only">Previous</span>
- </a>
- <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
- <span class="carousel-control-next-icon" aria-hidden="true"></span>
- <span class="sr-only">Next</span>
- </a>
- </div>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('cowse', 'stock_carousel_post');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement