WordPress.org

Ready to get started?Download WordPress

Forums

Display future posts creates 404 Error (1 post)

  1. heriz
    Member
    Posted 5 years ago #

    This is very weird, and an urgent problem - if anyone has any clues as to what's going on, please do let me know asap...

    I have a page which pulls in future posts to create an events page.

    The single view shows the post using this code:

    <?php /* If this is in category Events show Event posts */ if (in_category(4) && is_single()) { ?>
    	<?php if (have_posts()) : ?>
    
    	<?php while (have_posts()) : the_post(); ?>
    
    		<!-- LEFT WIDE COLUMN --><div id="left-column-wide">
    						<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<h2><?php the_title(); ?></h2>
    				<div id="event-details-main">
    				<h3><?php the_time('l, F jS, Y') ?></h3>
    				<?php // this is where the custom field prints the event's start and end times
    				$values = get_post_custom_values("event-time"); echo $values[0]; ?>,
    				<?php // this is where the custom field prints the event's venue
    				$values = get_post_custom_values("event-venue"); echo $values[0]; ?><br />
    				<?php // this is where the custom field prints the event's entry price
    				$values = get_post_custom_values("event-price"); echo $values[0]; ?>
    				</div>
    
    					<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    
    					<?php wp_link_pages(array('before' => '<div class="page-links"><span class="normal">Pages:</span> ', 'after' => '</div>', 'next_or_number' => 'number')); ?>
    					<!-- <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?> -->
    			</div>
    
    			<div class="commentbox"><?php comments_template(); ?></div>
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    	<?php endif; ?>

    And the list of posts in the right-hand sidebar is created with this code:

    <?php
    		$my_query = new WP_Query('category_name=events&post_status=future&order=ASC');
    		?>
    
    		<?php
    		if ($my_query->have_posts()) : while ($my_query->have_posts()) :
    		$my_query->the_post();
    		$do_not_duplicate = $post->ID;
    		?>
    
    		<dl class="giglist">
    		<dt><u><a href="<?php the_permalink(); ?>"><?php the_time('l, F jS, Y') ?></a></u>:</dt>
    		<dd><h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4></dd>
    		<dd><span class="small"><?php // this is where the custom field prints the event's venue
    				$values = get_post_custom_values("event-venue"); echo $values[0]; ?></span></dd>
    		</dl>
    
    		<?php endwhile;?>
    		<p>&nbsp;</p><p>&nbsp;</p>
    		<h4>Previous Events</h4>
    		<?php
    		$my_query = new WP_Query('category_name=events');
    		while ($my_query->have_posts()) : $my_query->the_post();
    		$do_not_duplicate = $post->ID;
    		?>
    
    		<dl class="giglist">
    		<dt><u><?php the_time('l, F jS, Y') ?></u>:</dt>
    		<dd><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd>
    		</dl>
    
    		<?php endwhile; else: ?>
    		<p><?php _e('Sorry, no shows at present.'); ?></p>
    		<?php endif; ?>

    The latter code is also used on the Category page, which readers click through to get to the single pages in that category.

    But the single pages are throwing up 404 error pages. At least, they are using the validator - the strangest thing is, I can see the posts working fine, despite turning off WP Supercache and clearing my browser's cache.

    Please help if you can!

Topic Closed

This topic has been closed to new replies.

About this Topic