• I searched and search the internet for information on how to style the comments error page, to no avail. What I did find was other people with the exact same question that I had. Having seen that, I thought I ought to post up my findings just so that in the future when a person like myself scours google for a wordpress answer, they can find it here.

    Depending on how comfortable you are with wordpress and changing code, the comments error page, whether it be posting too quickly, duplicate comments, or not entering info, is located starting at 2742 of the functions.php file.

    <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<title><?php echo $title ?></title>
    	<link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install.css" type="text/css" />
    <?php
    if ( 'rtl' == $text_direction ) : ?>
    	<link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install-rtl.css" type="text/css" />
    <?php endif; ?>
    </head>
    <body id="error-page">
    <?php endif; ?>
    	<?php echo $message; ?>
    </body>
    </html>
    <?php
    	die();
    }

    Here all you have is a rather empty page. Depending on how you customized your theme, you can do something like this:

    <?php get_header(); ?>
    <body id="error-page">
    <div id="page-content-wrapper">
    <?php get_sidebar(); ?>
    <?php endif; ?>
    	<?php echo $message; ?>
        </div>
        <?php get_footer(); ?>
    </body>
    </html>
    <?php
    	die();
    }

    All I did was add my header.php file, sidebar.php files, wrap it all in my wrapper div, add the footer.php, end my divs etc, and viola. Now the error page is wrapped in the same css as the rest of the website, staying to design. And then you can target the stuff in the error page via #error-page.

    Hope that helps someone.

  • The topic ‘Custom comments error page’ is closed to new replies.