• My theme didnt come with a 404 page so I am trying to add one but I cant seem to find the right plugin or create by scratch. I read this Creating an Error 404 Page from www.ads-software.com but it only shows the 404 page code and not anything esle ;for example what php code to add in the index.php. I would like to know all the steps for creating the 404 page and where to upload all the files or php codes. Please let me know if this makes sense or have any suggestions?

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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 + &raquo;') ?>
    
            </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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘404 Page question ?’ is closed to new replies.