Hi,
you need a file in your theme’s directory called 404.php
easiest way of doing this is just copying an existing file in your theme’s directory and rename it to 404.php (for example index.php or home.php depending on your theme)
next you edit the just created 404.php so that the content gets replaced by your 404 message.
Thread Starter
749831
<?php include('header.php'); ?>
<div id="container">
<div class="breaker"></div>
<?php include('sidebar.php'); ?>
<div id="content">
<div class="contentleft">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post_datetime">
<div class="datetime_text">
<?php the_time('M') ?> <div class="datetime_number"><?php the_time('d') ?></div>
</div>
</div>
<div class="post">
<div class="title" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</div>
<div class="category">
<?php _e("Filed under:"); ?> <?php the_category(' and') ?>
</div>
<div class="storycontent">
<?php the_content(__('(Continue reading...)')); ?>
</div>
<div class="meta">
<div class="author">
<?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?>
<?php wp_link_pages(); ?>
</div>
</div>
<div class="feedback">
<?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
</div>
<!--<?php trackback_rdf(); ?> -->
</div> <!-- Closes the post div-->
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
<div class="postnavigation">
<div class="rightdouble">
<?php posts_nav_link('','','previous posts + »') ?>
</div>
<div class="leftdouble">
<?php posts_nav_link('','« + newer posts ','') ?>
</div>
</div> <!-- Closes the postnavigation div -->
</div> <!-- Closes the contentleft div-->
</div> <!-- Closes the content div-->
</div> <!-- Closes the container div-->
<?php include('footer.php'); ?>
here is my index.php code ….what part of this should I change other than renaming the file to 404.php
try this:
<?php include('header.php'); ?>
<div id="container">
<div class="breaker"></div>
<?php include('sidebar.php'); ?>
<div id="content">
<div class="contentleft">
<?php _e('You've reached a 404, this page does not (longer) exist'); ?>
</div> <!-- Closes the contentleft div-->
</div> <!-- Closes the content div-->
</div> <!-- Closes the container div-->
<?php include('footer.php'); ?>
Thread Starter
749831
Now after I upload this file do I have to add any additional php codes to the function.php,index.php or header.php or thats it. I appreacite you help
no that’s it, if you want to have like a special 404 image or anything else than a just a message just replace this line:
<?php _e('You've reached a 404, this page does not (longer) exist'); ?>
Thread Starter
749831
Do you replace entire code or just the text in it<?php _e(‘You’ve reached a 404, this page does not (longer) exist’); ?>
If you dont mind could you give me a quick example on how to make the special 404 page with image or anything else by using the code line that you shown me above (anything). Thank you again