Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <div id="carousel" class="carousel slide col-lg-8 col-md-8 col-sm-8 col-xs-8" data-ride="carousel" data-interval="0">
  2. <!-- Wrapper for slides -->
  3. <div class="carousel-inner" role="listbox">
  4.  
  5. <?php
  6. $i = 2;
  7.  
  8. global $post;
  9. $args = array(
  10. 'numberposts' => -1,
  11. 'post_type' => 'work',
  12. 'orderby' => 'date',
  13. 'order' => 'ASC',
  14. );
  15.  
  16. $myposts = get_posts($args);
  17. if($myposts):
  18.  
  19. $chunks = array_chunk($myposts, $i);
  20. $html = "";
  21.  
  22. foreach($chunks as $chunk):
  23. // Sets as 'active' the first item
  24. ($chunk === reset($chunks)) ? $active = "active" : $active = "";
  25. $html .= '<div class="item '.$active.'">';
  26.  
  27. foreach($chunk as $post):
  28. $html .= '<div id="timeline-item" class="col-lg-6 col-md-6 col-sm-6 col-xs-6"><div><span style="text-align: left;">';
  29. $html .= get_the_date('Y');
  30. $html .= '</span><h2 style="text-align: left;">';
  31. $html .= get_the_title($post->ID);
  32. $html .= '</h2><p style="text-align: left;">';
  33. $html .= get_post_field('post_content', $post_id);
  34. $html .= '</p></div></div>';
  35. endforeach;
  36.  
  37. $html .= '</div>';
  38.  
  39. endforeach;
  40. echo $html;
  41.  
  42. endif;
  43. ?>
  44.  
  45. </div>
  46.  
  47. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement