<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>THE MOLITOR FORUMS &#187; Topic: Sort posts while excluding past events</title>
		<link>http://www.themolitor.com/forums/topic/sort-posts-while-excluding-past-events</link>
		<description>THE MOLITOR FORUMS &#187; Topic: Sort posts while excluding past events</description>
		<language>en-US</language>
		<pubDate>Wed, 29 Apr 2026 16:28:52 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.themolitor.com/forums/search.php</link>
		</textInput>
		<atom:link href="http://www.themolitor.com/forums/rss/topic/sort-posts-while-excluding-past-events" rel="self" type="application/rss+xml" />

		<item>
			<title>THE MOLITOR on "Sort posts while excluding past events"</title>
			<link>http://www.themolitor.com/forums/topic/sort-posts-while-excluding-past-events#post-37036</link>
			<pubDate>Wed, 16 Dec 2015 10:10:29 +0000</pubDate>
			<dc:creator>THE MOLITOR</dc:creator>
			<guid isPermaLink="false">37036@http://www.themolitor.com/forums/</guid>
			<description><p>Hi there,</p>
<p>Unfortunately that goes beyond the standard support services I can provide.</p>
<p>Best,</p>
<p>Christopher
</p></description>
		</item>
		<item>
			<title>ronsly on "Sort posts while excluding past events"</title>
			<link>http://www.themolitor.com/forums/topic/sort-posts-while-excluding-past-events#post-37032</link>
			<pubDate>Tue, 15 Dec 2015 17:52:45 +0000</pubDate>
			<dc:creator>ronsly</dc:creator>
			<guid isPermaLink="false">37032@http://www.themolitor.com/forums/</guid>
			<description><p>My goal is to display events on category pages with the next event at the top of the page, while displaying no past events.</p>
<p>I've attempted to adapt the front page's calendar loop to use on the category pages. However, when I include the expiration checker it breaks other loop functions such as else; and query_posts(). I realize this is a bit outside of the "support" realm, but I thought I'd check to see if you knew of a quick solution. If it is beyond the scope of this forum, no worries!</p>
<p><a href="http://www.outin.ca" rel="nofollow">http://www.outin.ca</a><br />
<pre><code>&#60;?php
$prev_month = &#039;&#039;;
$prev_year = &#039;&#039;;
$count = 0;
if ( $wp_query-&#62;have_posts() ) : while ($wp_query-&#62;have_posts()) : $wp_query-&#62;the_post(); 

//CHECK IF EVENT HAS EXPIRED
if(strtotime(get_the_time(&#039;Y-m-d&#039;)) &#62;= strtotime(date(&#039;Y-m-d&#039;))){

if(get_the_time(&#039;M&#039;) != $prev_month &#124;&#124; get_the_time(&#039;Y&#039;) != $prev_year){ 

$count++;

?&#62;

&#60;?php }	?&#62;

		&#60;div &#60;?php post_class(); ?&#62;&#62;

		&#60;?php get_template_part(&#34;thumbnail&#34;); ?&#62;

		&#60;a&#62;&#34;&#62;
			&#60;div class=&#34;dayInfo&#34;&#62;&#60;?php echo get_the_time(&#039;d&#039;); ?&#62;&#60;/div&#62;
			&#60;div class=&#34;timeInfo&#34;&#62;&#60;?php echo get_the_time(&#039;D @ g:i a&#039;); ?&#62;&#60;/div&#62;
			&#60;div class=&#34;monthInfo&#34;&#62;&#60;?php echo get_the_time(&#039;M Y&#039;); ?&#62;&#60;/div&#62;
		&#60;/a&#62;

		&#60;div class=&#34;listContent&#34;&#62;
		&#60;h2 class=&#34;posttitle&#34;&#62;&#60;a&#62;&#34; rel=&#34;bookmark&#34; title=&#34;Permanent Link to &#60;?php the_title_attribute(); ?&#62;&#34;&#62;&#60;?php the_title(); ?&#62;&#60;/a&#62;&#60;/h2&#62;

		&#60;div class=&#34;smallMeta&#34;&#62;
		&#60;i class=&#34;icon-folder-close&#34;&#62;&#60;/i&#62;  &#60;?php the_category(&#039;, &#039;); ?&#62;     &#60;i class=&#34;icon-user&#34;&#62;&#60;/i&#62; &#60;?php the_author(); ?&#62;
     &#60;i class=&#34;icon-comment&#34;&#62;&#60;/i&#62; &#60;?php comments_popup_link(__(&#039;0 Comments&#039;,&#039;themolitor&#039;), __(&#039;1 Comment&#039;,&#039;themolitor&#039;), __(&#039;% Comments&#039;,&#039;themolitor&#039;)); if(in_category($eventCat,get_the_ID()) &#38;&#38; strtotime(get_the_time(&#039;Y-m-d&#039;)) &#60; strtotime(date(&#039;Y-m-d&#039;))){?&#62;     &#60;i class=&#34;icon-exclamation red&#34;&#62;&#60;/i&#62;  &#60;?php _e(&#039;Event Expired&#039;,&#039;themolitor&#039;);?&#62;&#60;?php }?&#62;
		&#60;/div&#62;

		&#60;?php the_excerpt(); ?&#62;
		&#60;/div&#62;&#60;!--end listContent--&#62;

        &#60;div class=&#34;clear&#34;&#62;&#60;/div&#62;
		&#60;/div&#62;&#60;!--end post--&#62;

 &#60;?php
$prev_month = get_the_time(&#039;M&#039;);
$prev_year = get_the_time(&#039;Y&#039;);
}//END EXPIRATION CHECK
 endwhile;
 endif; ?&#62;

&#60;!--END DATE LIST--&#62;

 &#60;?php if ( $count==0 ) { ?&#62;
		&#60;h2 class=&#039;center&#039;&#62;&#60;?php _e(&#039;Not Found&#039;,&#039;themolitor&#039;);?&#62;&#60;/h2&#62;
		&#60;p class=&#039;center&#039;&#62;&#60;?php _e(&#34;Sorry, there are no upcoming events in this category.&#34;,&#039;themolitor&#039;);?&#62;&#60;/p&#62;
	&#60;?php }?&#62;

	&#60;/div&#62;&#60;!--end listing--&#62;
&#60;?php }
?&#62;</code></pre></description>
		</item>

	</channel>
</rss>
