Viewing 1 replies (of 1 total)
  • Thread Starter hcvitto

    (@hcvitto)

    thanks to

    http://wpguy.com/articles/an-archives-page-with-all-the-posts-in-cronological-order/

    i got to this solution

    <ul id="mainNav">
          <li><a href="">Archive</a>
          	<ul>
            <?php
    		// Declare some helper vars
    		$previous_year = $year = 0;
    		$ul_open = false;
    		// Get the posts
    		$myposts = get_posts('numberposts=-1&orderby=post_date&order=DESC');
    		foreach($myposts as $post) :
                // Setup the post variables
                setup_postdata($post);
                $year = mysql2date('Y', $post->post_date);
    			if($year != $previous_year) :
    				if($ul_open == true) : ?>
                        </ul></li>
                    <?php endif; ?>
                <li><?php the_time('Y'); ?>
                <ul class="month_archive">
    			<?php $ul_open = true;
    			endif;
    			$previous_year = $year;?>
                    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
            </ul></li></ul></li>
    
        </ul>
Viewing 1 replies (of 1 total)
  • The topic ‘create special drop down menu’ is closed to new replies.