StackTips
 2 minutes

WordPress Page Not Found 404 Page Template Sample

By Editorial @stacktips, On Sep 17, 2023 Wordpress 2.37K Views

While you work hard to make sure that every link actually goes to a specific web page on your site, there is always a chance that a link clicked will slam dunk and become a famous 404 ERROR PAGE NOT FOUND.

All is not lost. If your visitors encounter an error, why not be a helpful WordPress site administrator and present them with a message more useful than “NOT FOUND”

wordpress-404-error-page-template
404.php

<?php get_header(); ?>

<div id="content-wrapper">
    <div class="container">

        <main role="main" class="primary no-sidebar">
            <!-- section -->
            <section id="content-inner">

                <!-- article -->
                <article id="post-404" class="post-404">
                    <div class="post-404">
                        <h1 class="errorCode"><?php _e('404', THEME_SLUG); ?></h1>
                        <h3 class="errorMsg"><?php _e('It seems we can&rsquo;t find the page you&rsquo;re looking for.<br> Perhaps searching can help.', THEME_SLUG); ?></h3>
                        <?php get_search_form(); ?>
                    </div>

                </article>
                <!-- /article -->

            </section>
            <!-- /section -->
        </main>

        <?php //get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>
</div>
stacktips avtar

Editorial

StackTips provides programming tutorials, how-to guides and code snippets on different programming languages.