Skip to content

Instantly share code, notes, and snippets.

@menslow
Created May 3, 2013 17:42
Show Gist options
  • Save menslow/5511828 to your computer and use it in GitHub Desktop.
Save menslow/5511828 to your computer and use it in GitHub Desktop.
CMS driven 404 page for Genesis Framework
<?php
/**
* Handles display of 404 page.
*
* This file requires the creation of a page with the slug 'page-not-found'
*/
function jb_page_404(){
genesis_custom_loop( array('pagename' => 'page-not-found', 'posts_per_page' => 1 ) );
}
/* Remove default loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'jb_page_404' );
genesis();
@ammist
Copy link

ammist commented May 3, 2013

Unfortunately, this does not provide the Genesis 404 functionality if the page isn't created. That's what the other 60 lines were for. :)

@menslow
Copy link
Author

menslow commented Feb 20, 2014

I would opt to save the 60 lines of code and just make sure you create the "page-not-found"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment