Skip to content

Instantly share code, notes, and snippets.

@websupporter
Last active May 27, 2016 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save websupporter/38b7ea81261712bd8c169e9732fbb34a to your computer and use it in GitHub Desktop.
Save websupporter/38b7ea81261712bd8c169e9732fbb34a to your computer and use it in GitHub Desktop.
Use the wp_die_handler to alter your frontend dead
<?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