Note that there are some explanatory texts on larger screens.

plurals
  1. PO(Wordpress) Only show future posts in archive & search results
    text
    copied!<p>I have an events category which is searchable by a sub-category (by city where the event is being held). I have the 'The Future is Now!' plugin to allow me to publish future dated posts but hoping that I can set up a paginated template that, when a post 'expires' it will no longer show up in the loop/archive.</p> <p>I'm also wondering if you can filter out these posts from search results as well?</p> <p>This is my current Events page code if this helps:</p> <pre><code>&lt;h2&gt;Upcoming Events&lt;/h2&gt; &lt;ul class="posts"&gt; &lt;?php $limit = get_option('posts_per_page'); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('showposts=' . $limit . '&amp;paged=' . $paged .'&amp;cat=1&amp;order=ASC'); $wp_query-&gt;is_archive = true; $wp_query-&gt;is_home = false; ?&gt; &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt; &lt;li class="events_ticker" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;span class="left"&gt; &lt;h3&gt;&lt;?php the_time('F jS, Y') ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php if (strlen($post-&gt;post_title) &gt; 25) { echo substr(the_title($before = '', $after = '', FALSE), 0, 25) . '...';} else {the_title();} ?&gt;&lt;/p&gt; &lt;?php global $more; $more = 0; the_excerpt(); ?&gt; &lt;p&gt;&lt;a href="&lt;?php echo get_permalink(); ?&gt;"&gt;Read More&lt;/a&gt;&lt;/p&gt; &lt;/span&gt; &lt;a href="&lt;?php echo get_permalink(); ?&gt;"&gt;&lt;?php if ( function_exists("has_post_thumbnail") &amp;&amp; has_post_thumbnail() ) { the_post_thumbnail(array(143,110), array("class" =&gt; "right post_thumbnail")); } ?&gt;&lt;/a&gt; &lt;/li&gt; &lt;img src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/images/content_breaker_wide.png" alt=" breaker" class="content_breaker" /&gt; &lt;?php endwhile; ?&gt; &lt;/ul&gt; &lt;!-- end events loop --&gt; &lt;div class="navigation"&gt; &lt;p class="alignleft"&gt;&lt;?php next_posts_link('&lt; Next') ?&gt;&lt;/p&gt; &lt;p class="alignright"&gt;&lt;?php previous_posts_link('Next &gt;') ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;?php endif; ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload