Customize wordpress 404 page - Wordpress

The 404 page of Wordpress is displays when the page is not exist in wordpress site and if  link is not found.

you can edit or Modify this Page From theme foolder . To Change 404 page you have to edit the 404.php file wich is exist at your wp-content/themes/your_theme/404.php




you can Modify the 404 page here by adding some HTML code.(for eg. you can place an image that shows you are at wrong page or image that shows page not found)

So you can add the <img src="path"> in your 404.php file to shows image at Not Found Page.


If you are convert a HTML to Wordpress ??


If you are create anew wordpress theme , and 404 page looking messed up or dont display any thing ??

So First check that is the 404.php file is existing in your theme folder ??

If it is not so, you have to create it.

Then copy Same code as your page.php file.

Now Paste code in 404.php file.

Instead of the code that is display the page title and page content, Replace the code with following code.

 <h1><strong>404</strong> <?php _e('error', 'yiw') ?></h1>
        <h3><?php _e('Page not found', 'yiw') ?> <img src="<?php echo get_template_directory_uri() ?>/images/icons/search.png" alt="<?php _e('Page not found', 'yiw') ?>" /></h3>    
    
        <p>
            <?php _e('We are sorry but the page you are looking for does not exist.', 'yiw') ?><br/>
            <?php _e('You could retourn to the ', 'yiw') ?> <a href="<?php echo home_url() ?>">homepage</a> <?php _e('or search using the search box below', 'yiw') ?>
        </p>
        
        <!-- START SEARCH -->
        <form method="get" id="searchform" action="<?php echo home_url(); ?>/">
            <fieldset>
                <input type="text" name="s" id="s" value="<?php the_search_query(); ?>" />
                <input type="submit" id="searchsubmit" value="GO" />
            </fieldset>
        </form>             
        <!-- END SEARCH -->


Save this page as 404.php in your theme folder.

Comments