Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

search for default 404.png or 404.jpg in the theme.

  • Loading branch information...
commit 08ec2d0a4c47e95df39cb40cc6fd15556c5a4e43 1 parent fe2a88a
@toscho authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 t5-404-tools.php
View
16 t5-404-tools.php
@@ -209,10 +209,20 @@ protected function get_ip_data()
*/
protected function serve_404_image()
{
- $path = apply_filters( 't5_404_img_path', __DIR__ . '/404.png' );
- $type = apply_filters( 't5_404_img_type', 'image/png' );
+ // Try to find a 404 image in the current theme.
+ $path = locate_template( array ( '404.png', '404.jpg', '404.gif' ) );
- header( "Content-Type: $type" );
+ if ( '' == $path )
+ {
+ $path = apply_filters( 't5_404_img_path', __DIR__ . '/404.png' );
+ $type = apply_filters( 't5_404_img_type', 'png' );
+ }
+ else
+ {
+ $type = pathinfo( $path, PATHINFO_EXTENSION );
+ }
+
+ header( "Content-Type: img/$type" );
require $path;
exit;
}
Please sign in to comment.
Something went wrong with that request. Please try again.