Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_shortcode( 'video-testimonials', 'sls_video_testimonial_short_code' );
- function sls_video_testimonial_short_code( $atts ) {
- ob_start();
- $query = new WP_Query( array(
- 'post_type' => 'video-testimonial',
- 'posts_per_page' => 4,
- 'order' => 'ASC',
- 'orderby' => 'title',
- ) );
- if ( $query->have_posts() ) { ?>
- <div class="vid-testimonials">
- <?php while ( $query->have_posts() ) : $query->the_post(); ?>
- <div class="indv_vid_test">
- <h3>
- <?php the_title(); ?>
- </h3>
- <p class="the_date">
- <?php the_field("video_date"); ?>
- </p>
- <div class="the_video">
- <?php echo wp_oembed_get(get_field("video_url"), array('width'=>295)); ?>
- </div>
- </div>
- <?php endwhile;
- wp_reset_postdata(); ?>
- </div>
- <div class="clearfix"></div>
- <p id="more-vids"><a href="/video-testimonial/">View more</a></p>
- <?php $myvariable = ob_get_clean();
- return $myvariable;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment