Skip to content

Instantly share code, notes, and snippets.

@codescribblr
Created February 13, 2014 21:41
Show Gist options
  • Save codescribblr/8984434 to your computer and use it in GitHub Desktop.
Save codescribblr/8984434 to your computer and use it in GitHub Desktop.
Custom Page Templates in a WordPress Plugin
add_filter( 'page_template', 'wpa3396_page_template' );
function wpa3396_page_template( $page_template )
{
if ( is_page( 'my-custom-page-slug' ) ) {
$page_template = dirname( __FILE__ ) . '/custom-page-template.php';
}
return $page_template;
}
@frost0103q
Copy link

frost0103q commented Sep 28, 2020

what can be 'my-custom-page-slug' ?

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