Guest User

Untitled

a guest
Oct 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * Custom Blog Loop for Bradonomics.
  5. *
  6. * Template Name: Bradonomics Blog
  7. *
  8. */
  9.  
  10. //* Remove standard post content output
  11. remove_action( 'genesis_loop', 'genesis_do_loop' );
  12.  
  13. //* Add Page Title and Content
  14. add_action( 'genesis_loop', 'genesis_standard_loop', 5 );
  15.  
  16. //* Add custom archive output
  17. add_action( 'genesis_loop', 'bradonomics_blog_template' );
  18. function bradonomics_blog_template() {
  19.  
  20. $post_items = new WP_Query( array(
  21. 'post_type'=> 'post',
  22. 'showposts' => '-1',
  23. 'order' => 'DESC',
  24. 'orderby' => 'date'
  25. ));
  26. $set_year = '';
  27.  
  28. while( $post_items->have_posts()) : $post_items->the_post();
  29. if( $set_year == '' ){
  30. $set_year = get_the_date(Y);
  31. echo '<div class="wrap"><div class="group-year"><p>' . get_the_date(Y) . '</p>';
  32. }else{
  33. if( $set_year != get_the_date(Y) ){
  34. echo '</div>';
  35. echo '<div class="group-year"><p>' .get_the_date(Y) . '</p>';
  36. $set_year = get_the_date(Y);
  37. }
  38. }
  39. echo '<article>';
  40. echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
  41. echo '<time><span class="month">' . get_the_date(M) . '</span> <span class="day">' . get_the_date(j) . '</span> <span class="year">' . get_the_date(Y) . '</span></time>';
  42. echo '</article>';
  43.  
  44. endwhile;
  45. }
  46.  
  47. genesis();
Add Comment
Please, Sign In to add comment