Forums

Only future posts in archive & search results (2 posts)

  1. shakingpaper
    Member
    Posted 1 year ago #

    Hi there,

    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.

    I'm also wondering if you can filter out these posts from search results as well?

    Any advice would be greatly appreciated.

  2. shakingpaper
    Member
    Posted 1 year ago #

    This is my current Events page code if this helps:

    <h2>Upcoming Events</h2>
    			<ul class="posts">
    				<?php
    			    $limit = get_option('posts_per_page');
    			    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    			    query_posts('showposts=' . $limit . '&paged=' . $paged .'&cat=1&order=ASC');
    			    $wp_query->is_archive = true; $wp_query->is_home = false;
    			    ?>
    			    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    					<li class="events_ticker" id="post-<?php the_ID(); ?>">
    					<span class="left">
    					<h3><?php the_time('F jS, Y') ?></h3>
    					<p><?php if (strlen($post->post_title) > 25) { echo substr(the_title($before = '', $after = '', FALSE), 0, 25) . '...';} else {the_title();} ?></p>
    					<?php global $more; $more = 0; the_excerpt(); ?>
    					<p><a href="<?php echo get_permalink(); ?>">Read More</a></p>
    					</span>
    						<a href="<?php echo get_permalink(); ?>"><?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(143,110), array("class" => "right post_thumbnail")); } ?></a>
    					</li>
    					<img src="<?php bloginfo('stylesheet_directory'); ?>/images/content_breaker_wide.png" alt=" breaker" class="content_breaker" />
    				<?php endwhile; ?>
    			</ul>
    			<!-- end events loop -->
    			<div class="navigation">
    				<p class="alignleft"><?php next_posts_link('< Next') ?></p>
    				<p class="alignright"><?php previous_posts_link('Next >') ?></p>
    			</div>
    
    	<?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic