Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Last active September 27, 2018 07:54
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 spencerfinnell/46646f6a98dd9e01ab365734fc895024 to your computer and use it in GitHub Desktop.
Save spencerfinnell/46646f6a98dd9e01ab365734fc895024 to your computer and use it in GitHub Desktop.
<?php
add_filter(
'page_template_hierarchy',
function( $templates ) {
$add = [];
if ( is_cart() ) {
$add[] = 'resources/views/layout/cart.php';
}
if ( is_checkout() ) {
$add[] = 'resources/views/layout/checkout.php';
}
// Prepend any found templates.
if ( ! empty( $add ) ) {
$templates = array_merge( $add, $templates );
}
return $templates;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment