WordPress.org

Ready to get started?Download WordPress

Forums

Monthly Archives Template Customization (1 post)

  1. dcartgallery
    Member
    Posted 4 years ago #

    Hi,

    I am using WordPress to run a newsletter website. I have made the frontpage behave exactly as I want it to, and you can see it here.

    http://dcartgallery.ca/newsletter/

    What I want to do now is have the monthly archives page appear in the same format as the front page, except with that month's articles/content (obviously).

    Except, I can't get it to do it! If I use the same code I use on my frontpage template, it will just bring up all the current information, not the archive content of that particular month like its supposed to.

    Help!

    Here's my front page code for reference:

    <?php
    /*
    Template Name: Front
    */
    ?>
    <?php get_header(); ?>
    
    	<?php $my_query = new WP_Query('category_name=exhibition&showposts=1');
      		while ($my_query->have_posts()) : $my_query->the_post();
     		$do_not_duplicate = $post->ID;?>
    
    	<div id="show" style="background: #888 url(images/exhibition-front-<?php the_time('m'); ?>-<?php the_time('Y'); ?>.jpg) top center;">
    		<div id="show-title">
    			<h2>Current Exhibition</h2>
    			<div id="show-opening">Show opens <?php $custom_fields = get_post_custom($post->ID);
     				 $my_custom_field = $custom_fields['opening'];
     				 foreach ( $my_custom_field as $key => $value )
       				 echo  "" . $value . ""; ?></div>
    			<div class="c"></div>
    		</div>
    		<div id="show-name"><h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Full Article: <?php the_title(); ?>"><?php the_title(); ?></a></h3></div>
    		<div id="show-artists">Featuring the work of <?php $custom_fields = get_post_custom($post->ID);
     				 $my_custom_field = $custom_fields['artist'];
     				 foreach ( $my_custom_field as $key => $value )
       				 echo  "" . $value . ""; ?>
      		</div>
    		<div id="show-description">
    <?php
    global $more;    // Declare global $more (before the loop).
    $more = 0;       // Set (inside the loop) to display content above the more tag.
    the_content("Read more?");
    ?>
    
    		</div>
    	</div>
    
    	<?php endwhile; ?>
      <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
       <!-- Do stuff... -->
      <?php endwhile; endif; ?>
    
    	<div id="art-events" class="column">
    		<h2>Gallery Events</h2>
    		<p>Events, classes and programs hosted by the Dawson Creek Art Gallery.</p>
    
    			<?php
    				$postslist = get_posts('numberposts=2&order=DESC&orderby=date&category=1');
    				foreach ($postslist as $post) :
    				setup_postdata($post);
    			?> 
    
    		<div class="event">
    			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    			<div class="event-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'medium' ); ?></a></div>
    			<?php the_excerpt(); ?><br /><a href="<?php the_permalink(); ?>" class="event-link">...Read the full article &raquo;</a>
    		</div>
    
     			<?php endforeach; ?>
    
     			<a href="/newsletter/category/art-gallery" class="column-button-more">Read about more Gallery events</a>
    
    	</div>
    	<div id="kpac-events" class="column">
    		<h2>Local Events</h2>
    		<p>What's happening around Dawson Creek and at the Kiwanis Performing Arts Centre.</p>
    
    			<?php
    				$postslist = get_posts('numberposts=2&order=DESC&orderby=date&category=4');
    				foreach ($postslist as $post) :
    				setup_postdata($post);
    			?> 
    
    		<div class="event">
    			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    			<div class="event-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'medium' ); ?></a></div>
    			<?php the_excerpt(); ?><br /><a href="<?php the_permalink(); ?>" class="event-link">...Read the full article &raquo;</a>
    		</div>
    
     			<?php endforeach; ?>
    
     			<a href="/newsletter/category/local" class="column-button-more">Read about more local events</a>
    
    	</div>
    	<div id="past-events" class="column last-column">
    		<h2>Past Events</h2>
    		<p>Coverage of the events that have already happened, with pictures and videos!</p>
    
    			<?php
    				$postslist = get_posts('numberposts=2&order=DESC&orderby=date&category=13');
    				foreach ($postslist as $post) :
    				setup_postdata($post);
    			?> 
    
    		<div class="event">
    			<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    			<div class="event-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'medium' ); ?></a></div>
    			<?php the_excerpt(); ?><br /><a href="<?php the_permalink(); ?>" class="event-link">...Read the full article &raquo;</a>
    		</div>
    
     			<?php endforeach; ?>
    
     			<a href="/newsletter/category/coverage" class="column-button-more">Read about more past events</a>
    
    	</div>
    <div class="clear c"></div>
    	<div id="article">
    <h2 class="calendar">Events Calendar for	<span class="calendar-month"><?php $my_query = new WP_Query('category_name=exhibition&showposts=1');
      		while ($my_query->have_posts()) : $my_query->the_post();
     		$do_not_duplicate = $post->ID;?><?php the_time('F Y'); ?><?php endwhile; ?>
     		<?php if (have_posts()) : while (have_posts()) : the_post();
     		if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    		<?php endwhile; endif; ?></span></h2>
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    				<?php the_content(''); ?>
    				<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    	</div>
    		<?php endwhile; endif; ?>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic