• Resolved solutiodesign

    (@solutiodesign)


    I have a client that wants to have upcoming events show on top of a page and past events show below those. I have the upcoming events showing up how I want, but I can’t figure out how to make the past events appear. I am not a PHP programmer by any stretch, but I make my way around. The site has a blog on it already, so I am only showing cat=7 for my events. My Here’s the code, Past events is about halfway down. Thanks in advance.

    <?php
    /*
    Template Name: Events
    */
    global $more, $k_options;
    get_header(); 
    
    $more = 0;
    $negative_cats = preg_replace("!(\d)+!","-${0}$0", $k_options['blog']['blog_cat_final']);
    
    $query_string = "cat=".$negative_cats."&paged=$paged";
    query_posts($query_string);
    
    ?>
    
     <div id="content" class="bg_sidebar">
               <div id="inner_content">
               <h2>Upcoming Events</h2>
               <?php query_posts('cat=7'); ?>
                <?php if (have_posts()) : while (have_posts()) : the_post();
                $punchline = get_post_meta($post->ID, "punchline", true);
    			$portfolio_image = get_post_meta($post->ID, "portfolio-image", true);
    			?>
    
               <div class="entry">
    
               <span class="meta"><?php echo $punchline; ?></span>
               <div class="entry-head">
                <table width="570" border="0" cellspacing="0" cellpadding="0">
                 <tr>
                  <td width="142"><span class="categories"><id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></span></td>
                  <td width="143"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_start_date(); ?></a></span></td>
                  <td width="143"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_venue(); ?></span></a></td>
                  <td width="142"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_city(); ?></span><span class="categories">,&nbsp;<?php echo the_event_state(); ?></a></span></td>
                 </tr>
                </table>
                   <?php edit_post_link('Edit', ' ,', ''); ?></span>
               </div>
    
               <div class="entry-content">
               <?php
               if($portfolio_image != "") echo '<img class="aligncenter" src="'.$portfolio_image.'" alt="" />';
               ?>
               <!--<?php the_content("Read more »"); ?>-->
     			</div><!--end entry-content-->
     			<?php the_tags( '<p class="meta">Tags: ', ', ', '</p>'); ?>
    			</div><!--end entry-->
    
               	<?php endwhile;
               	kriesi_pagination($query_string);
               	else: ?>
    	<div class="entry">
    	<h2>Nothing Found</h2>
    	<p>Sorry, no posts matched your criteria.</p>
    </div>
    
    <!--do not delete-->
    <?php endif; ?>
            <h2>Past Events</h2>
             <?php query_posts('cat=7'); ?>
                <?php if (have_posts()) : while (have_posts()) : the_post();
                $punchline = get_post_meta($post->ID, "punchline", true);
    			$portfolio_image = get_post_meta($post->ID, "portfolio-image", true);
    			?>
    
               <div class="entry">
    
               <span class="meta"><?php echo $punchline; ?></span>
               <div class="entry-head">
                <table width="570" border="0" cellspacing="0" cellpadding="0">
                 <tr>
                  <td width="142"><span class="categories"><id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></span></td>
                  <td width="143"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_start_date(); ?></a></span></td>
                  <td width="143"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_venue(); ?></span></a></td>
                  <td width="142"><a href="<?php echo get_permalink() ?>"<span class="categories"><?php echo the_event_city(); ?></span><span class="categories">,&nbsp;<?php echo the_event_state(); ?></a></span></td>
                 </tr>
                </table>
                   <?php edit_post_link('Edit', ' ,', ''); ?></span>
               </div>
    
               <div class="entry-content">
               <?php
               if($portfolio_image != "") echo '<img class="aligncenter" src="'.$portfolio_image.'" alt="" />';
               ?>
               <!--<?php the_content("Read more »"); ?>-->
     			</div><!--end entry-content-->
     			<?php the_tags( '<p class="meta">Tags: ', ', ', '</p>'); ?>
    			</div><!--end entry-->
    
               	<?php endwhile;
               	kriesi_pagination($query_string);
               	else: ?>
    	<div class="entry">
    	<h2>Nothing Found</h2>
    	<p>Sorry, no posts matched your criteria.</p>
    </div>
    
    <!--do not delete-->
    <?php endif; ?>
    
     </div><!-- end inner_content-->          
    
     <?php get_sidebar(); ?>          
    
    </div><!-- end content-->
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • Hi! I see this question is marked “resolved” but there is no followup listed. I’m interested in the same question – how did you solve it?

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: The Events Calendar] The Calendar Events – Help with showing Past Events on same page’ is closed to new replies.