Guest User

Untitled

a guest
Feb 23rd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. /*
  3. Template name: Homepage
  4. */
  5. get_header();
  6.  
  7. if ( have_rows('slider') ) : while ( have_rows('slider') ) : the_row();
  8.  
  9. /**
  10. * Image and video
  11. */
  12. $media = get_sub_field('media');
  13.  
  14. // The image...
  15. echo sprintf( '<img src="%s">', $media['image']['url'] );
  16.  
  17. // If we also have a video...
  18. if ( $media['video'] ) {
  19. echo sprintf(
  20. '<video><source src="%s" type="%s"></video>',
  21. $media['video']['url'],
  22. $media['video']['mime_type']
  23. );
  24. }
  25.  
  26. /**
  27. * Print the headline
  28. */
  29. the_sub_field('headline');
  30.  
  31. /**
  32. * Buttons
  33. */
  34. if ( have_rows('buttons') ) : while ( have_rows('buttons') ) : the_row();
  35.  
  36. $button = get_sub_field('button');
  37. echo sprintf(
  38. '<a href="%s">%s</a>',
  39. $button['url'],
  40. $button['title']
  41. );
  42.  
  43. endwhile; endif;
  44.  
  45. endwhile; endif;
  46.  
  47. get_footer();
  48. ?>
Add Comment
Please, Sign In to add comment