Skip to content

Instantly share code, notes, and snippets.

@qstudio
Last active December 20, 2020 12:34
Show Gist options
  • Save qstudio/0c91edf447e9606c00c4bf7c7af8ade0 to your computer and use it in GitHub Desktop.
Save qstudio/0c91edf447e9606c00c4bf7c7af8ade0 to your computer and use it in GitHub Desktop.
Adding native WordPress templates to Willow
<?php
// factory.php
$config = new q\theme\child\core\config();
$config->hooks();
// config.php
namespace q\theme\child\core;
class config {
function __construct(){
// ... empty ##
}
function hooks(){
// add native views ##
\add_filter( 'willow/view/native', function( $array ){
return array_merge(
[
// default pages to view/page.willow
'page' => [
'function' => 'is_singular',
'argument' => 'page',
'template' => 'page.willow',
],
'single-post' => [
'function' => 'is_singular',
'argument' => 'post',
'template' => 'single-post.willow',
],
],
$array
);
}, 100, 1 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment