Created
October 16, 2020 13:03
-
-
Save dacmail/c7c5b4f59599b2da349ec9ae56bdf07c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
namespace App; | |
if (defined('ABSPATH')) { | |
add_action('after_setup_theme', function () { | |
add_theme_support('sensei'); | |
}); | |
/** | |
* @param string $template | |
* @return string | |
*/ | |
function sensei_template_loader(String $template) | |
{ | |
return strpos($template, Sensei()->plugin_path()) === -1 | |
? $template | |
: (locate_template(str_replace(Sensei()->plugin_path() . '/templates/', Sensei()->template_url, $template)) ?: $template); | |
} | |
add_filter('template_include', __NAMESPACE__ . '\\sensei_template_loader', 100, 1); | |
add_filter('comments_template', __NAMESPACE__ . '\\sensei_template_loader', 100, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment