Adding native WordPress templates to Willow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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