Last active
December 26, 2020 08:32
-
-
Save rocket-martue/98c32b388242f226456da064924d9815 to your computer and use it in GitHub Desktop.
テーマのincディレクトリにあるテンプレートを呼び出すショートコード
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
add_shortcode( 'inc_file', function ( $atts ) { | |
extract( shortcode_atts( | |
array( | |
'slug' => '', | |
), $atts ) ); | |
ob_start(); | |
get_template_part( 'inc/'.$slug ); | |
$html = ob_get_contents(); | |
ob_end_clean(); | |
return $html; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment