Created
January 7, 2019 11:46
-
-
Save kurudrive/cafda2f076ad8668490f71ed729d7315 to your computer and use it in GitHub Desktop.
WordPressでテーマのテンプレートファイルではなくプラグインなどから任意のファイルを読み込ませる ref: https://qiita.com/kurudrive/items/e041da63b981332653c6
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
function my_custom_template_file() { | |
if ( get_post_type() == 'post' && is_single() ) { | |
// 読み込ませたいファイルを指定 | |
require( 'template-parts/doc/frame-salary-archive.php' ); | |
die(); | |
} | |
} | |
add_action( 'template_redirect', 'my_custom_template_file' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment