miko67
Jan 15th 2006, 2:17 pm
I have a wordpress index.php that runs through this code:
<!-- S T A R T M A I N C O N T E N T -->
<div id="main">
<?phpif(have_posts()):while(have_posts()): the_post();?>
<?php the_date('','<h2>','</h2>');?>
<div class="post">
<h3 class="storytitle" id="post-<?php the_ID();?>"><a href="<?php the_permalink()?>" rel="bookmark">
<?php the_title();?>
</a></h3>
<div class="meta">
<?php _e("Filed under:");?>
<?php the_category(',')?> <?php the_author()?> @ <?php the_time()?>
<?php edit_post_link(__('Edit This'));?>
</div>
<div class="storycontent">
<?php the_content(__('(more...)'));?>
</div>
<div class="feedback" align="right">
<?php wp_link_pages();?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));?>
</div>
<!-- <?php// trackback_rdf(); ?> -->
</div>
<divclass="postend"> " " " </div>
<?php comments_template();// Get wp-comments.php template ?>
<?phpendwhile;else:?>
<p>
<?php _e('Sorry, no posts matched your criteria.');?>
</p>
<?phpendif;?><?php posts_nav_link(' ', __('« Previous Page'), __('Next Page »'));?>
</div>
<!-- E N D M A I N C O N T E N T -->My problem is, that when I get to the part of the loop where there is no posts to post (ie. There is a faulty URI or a dead link), wordpress just serves me this line ('Sorry, no posts matched your criteria), as a integrated part of a wordpress theme.
This is no good, because there needs to be a header in the 404 page saying something like this:
<?php header("HTTP/1.1 404 Not Found");?>And here is my callenge and job-to-do:
I (think that I) need to make some kind of “IF” statement in the top of the header or before the header saying something like “if this is a faulty URI or if no posts meet your criteria, then go to 404.php and present that”
I have tried to mix up som php for that but couldn’t get it to work.
Is there anybody out there who can figure this one out?
Help is really appreciated.
<!-- S T A R T M A I N C O N T E N T -->
<div id="main">
<?phpif(have_posts()):while(have_posts()): the_post();?>
<?php the_date('','<h2>','</h2>');?>
<div class="post">
<h3 class="storytitle" id="post-<?php the_ID();?>"><a href="<?php the_permalink()?>" rel="bookmark">
<?php the_title();?>
</a></h3>
<div class="meta">
<?php _e("Filed under:");?>
<?php the_category(',')?> <?php the_author()?> @ <?php the_time()?>
<?php edit_post_link(__('Edit This'));?>
</div>
<div class="storycontent">
<?php the_content(__('(more...)'));?>
</div>
<div class="feedback" align="right">
<?php wp_link_pages();?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'));?>
</div>
<!-- <?php// trackback_rdf(); ?> -->
</div>
<divclass="postend"> " " " </div>
<?php comments_template();// Get wp-comments.php template ?>
<?phpendwhile;else:?>
<p>
<?php _e('Sorry, no posts matched your criteria.');?>
</p>
<?phpendif;?><?php posts_nav_link(' ', __('« Previous Page'), __('Next Page »'));?>
</div>
<!-- E N D M A I N C O N T E N T -->My problem is, that when I get to the part of the loop where there is no posts to post (ie. There is a faulty URI or a dead link), wordpress just serves me this line ('Sorry, no posts matched your criteria), as a integrated part of a wordpress theme.
This is no good, because there needs to be a header in the 404 page saying something like this:
<?php header("HTTP/1.1 404 Not Found");?>And here is my callenge and job-to-do:
I (think that I) need to make some kind of “IF” statement in the top of the header or before the header saying something like “if this is a faulty URI or if no posts meet your criteria, then go to 404.php and present that”
I have tried to mix up som php for that but couldn’t get it to work.
Is there anybody out there who can figure this one out?
Help is really appreciated.