kevinobvious
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: custom comment error pageOne small “oops”. The code above doesn’t work for admin pages. If you wrap the above code in a “functions_exists” block you should be good to go:
if (function_exists('get_template_directory')){ $templatedir = get_template_directory(); if ( file_exists($templatedir.'/die.php') ){ include($templatedir.'/die.php'); die(); } }Forum: Installing WordPress
In reply to: custom error page for commentsI posted a possible solution to this problem in the following thread.
http://wordpress.org/support/topic/109477?replies=6#post-660233
Forum: Fixing WordPress
In reply to: custom comment error pageI didn’t find an answer to this either so I made one. Using what kprensac said as a hint I started looking through wp-includes/functions.php and here’s what I did.
I inserted the following code inside the wp_die() function just before it starts outputting the html for the error page. Its two lines before the “<!DOCTYPE html PUBLIC” stuff. For me, I have version 2.3.1 which made the line number 1259 (I’m not sure about other versions of wordpress). Here’s the code I added.
$templatedir = get_template_directory(); if ( file_exists($templatedir.'/die.php') ){ include($templatedir.'/die.php'); die(); }This will check for a “die.php” file in your template directory and use that for the error page if it finds it. Otherwise, it will use the built in wordpress one.
At some point inside the die.php file you will need to print the contents of the “$message” variable. That variable contains the actual error message.
I ended up copying my single.php to die.php and edited things from there.