Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell spencerfinnell/functions.php Secret
Last active Sep 27, 2018

Embed
What would you like to do?
<?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
You can’t perform that action at this time.