Guest User

Untitled

a guest
Apr 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. add_shortcode( 'video-testimonials', 'sls_video_testimonial_short_code' );
  4. function sls_video_testimonial_short_code( $atts ) {
  5. ob_start();
  6. $query = new WP_Query( array(
  7. 'post_type' => 'video-testimonial',
  8. 'posts_per_page' => 4,
  9. 'order' => 'ASC',
  10. 'orderby' => 'title',
  11. ) );
  12. if ( $query->have_posts() ) { ?>
  13. <div class="vid-testimonials">
  14. <?php while ( $query->have_posts() ) : $query->the_post(); ?>
  15. <div class="indv_vid_test">
  16. <h3>
  17. <?php the_title(); ?>
  18. </h3>
  19. <p class="the_date">
  20. <?php the_field("video_date"); ?>
  21. </p>
  22.  
  23. <div class="the_video">
  24. <?php echo wp_oembed_get(get_field("video_url"), array('width'=>295)); ?>
  25. </div>
  26. </div>
  27.  
  28. <?php endwhile;
  29. wp_reset_postdata(); ?>
  30. </div>
  31. <div class="clearfix"></div>
  32. <p id="more-vids"><a href="/video-testimonial/">View more</a></p>
  33. <?php $myvariable = ob_get_clean();
  34. return $myvariable;
  35. }
  36. }
  37.  
  38. ?>
Add Comment
Please, Sign In to add comment