• OK. I have a list of archives here
    https://theworldwidenews.info/sitemap/

    The code I have is

    <?php
    
    	// Declare some helper vars
    	$previous_year = $year = 0;
    	$previous_month = $month = 0;
    	$ul_open = false;
    
    	// Get the posts
    	$myposts = get_posts('numberposts=-1&orderby=post_date&order=DESC');
    
    	?>
    
    <?php foreach($myposts as $post) : ?>	
    
    	<?php
    
    	// Setup the post variables
    	setup_postdata($post);
    
    	$year = mysql2date('Y', $post->post_date);
    	$month = mysql2date('n', $post->post_date);
    	$day = mysql2date('j', $post->post_date);
    
    	?>
    
    	<?php if($year != $previous_year || $month != $previous_month) : ?>
    
    		<?php if($ul_open == true) : ?>
    		</ul>
    
    		<?php endif; ?>
    
    		<br />
    		<h3><?php the_time('F Y'); ?></h3>
    
    		<ul id="archive-list" class="clearfloat">
    
    		<?php $ul_open = true; ?>
    
    	<?php endif; ?>
    
    	<?php $previous_year = $year; $previous_month = $month; ?>
    
    	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span class="commentcount">(<?php comments_number('0', '1', '%'); ?>)</span></li>
    
    <?php endforeach; ?>
    			</ul>

    Call me dumb, but I cant figure out how to make the month link to the appropriate page in the archives. Can anyone help? My eternal devotion is assured.

  • The topic ‘Archives List – Make Month link to appropriate page’ is closed to new replies.