Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * Custom Blog Loop for Bradonomics.
- *
- * Template Name: Bradonomics Blog
- *
- */
- //* Remove standard post content output
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- //* Add Page Title and Content
- add_action( 'genesis_loop', 'genesis_standard_loop', 5 );
- //* Add custom archive output
- add_action( 'genesis_loop', 'bradonomics_blog_template' );
- function bradonomics_blog_template() {
- $post_items = new WP_Query( array(
- 'post_type'=> 'post',
- 'showposts' => '-1',
- 'order' => 'DESC',
- 'orderby' => 'date'
- ));
- $set_year = '';
- while( $post_items->have_posts()) : $post_items->the_post();
- if( $set_year == '' ){
- $set_year = get_the_date(Y);
- echo '<div class="wrap"><div class="group-year"><p>' . get_the_date(Y) . '</p>';
- }else{
- if( $set_year != get_the_date(Y) ){
- echo '</div>';
- echo '<div class="group-year"><p>' .get_the_date(Y) . '</p>';
- $set_year = get_the_date(Y);
- }
- }
- echo '<article>';
- echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
- 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>';
- echo '</article>';
- endwhile;
- }
- genesis();
Add Comment
Please, Sign In to add comment