Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function edge_subcat_posts_monthly($curr_post, $curr_cat) {
- global $post;
- $ul_open = false;
- $previous_year = 0;
- $args=array(
- 'cat' => $curr_cat,
- 'posts_per_page' => -1,
- 'orderby' => 'date',
- 'order' => 'DESC',
- 'caller_get_posts'=>1
- );
- $my_query = new WP_Query($args);
- echo '<ul>';
- if( $my_query->have_posts() ) {
- $ymdate = '';
- while ($my_query->have_posts()) : $my_query->the_post();
- $year = mysql2date("Y", $post->post_date);
- if ( $previous_year != $year) {
- if($ul_open == true){
- echo '</ul><div class="clear"></div>';
- }
- echo '<li><div class="clear"></div><h4 id="cat-'.$year.'">'.$year.'</h4><ul id="posts-'.$year.'" >';
- $ul_open = true;
- }
- $previous_year = $year;
- ?>
- <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" <?php if($curr_post == $post->ID){ echo 'class="active"'; } ?>><?php the_title(); ?></a></li>
- <?php
- endwhile;
- echo '</ul><div class="clear"></div>';
- }
- echo '</ul>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement