Last active
June 27, 2016 22:12
-
-
Save bacoords/5e41c62aa9b295cf9b0a9a6c12168e41 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
// Custom Templates Shortcode to Get Templates from the /templates Directory | |
// Usage: [gettemplate name="templatename"] | |
function prefix_templates_shortcode_function( $atts ){ | |
$a = shortcode_atts( array( | |
'name' => 'none' | |
), $atts ); | |
ob_start(); | |
get_template_part('templates/' . $a['name']); | |
return ob_get_clean(); | |
} | |
add_shortcode('gettemplate', 'prefix_templates_shortcode_function'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment