Last active
May 27, 2016 10:06
-
-
Save websupporter/38b7ea81261712bd8c169e9732fbb34a to your computer and use it in GitHub Desktop.
Use the wp_die_handler to alter your frontend dead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Schöner Sterben mit wp_die() | |
* Plugin Author: David Remer/Websupporter | |
**/ | |
add_filter( 'wp_die_handler', 'die_in_beauty_filter' ); | |
function die_in_beauty_filter( $die_handler ) { | |
if ( is_admin() ) { | |
return $die_handler; | |
} | |
return 'die_in_beauty'; | |
} | |
function die_in_beauty( $message, $title, $args ) { | |
get_header(); | |
if ( empty( $title ) ) { | |
$title = 'Ein Fehler ist aufgetreten'; | |
} | |
?> | |
<div id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<article class="error"> | |
<header class="entry-header"> | |
<h1><?php echo $title; ?></h1> | |
</header> | |
<div class="entry-content"> | |
<?php echo apply_filters( 'the_content', $message ); ?> | |
</div> | |
<footer class="entry-footer"> | |
<p style="text-align:center;font-size:6rem;">😲</p> | |
</footer> | |
</article> | |
</main> | |
</div> | |
<?php | |
get_sidebar(); | |
get_footer(); | |
die(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment