Last active
October 8, 2019 17:52
-
-
Save cccamuseme/ddce39c45050546a6ae84063b2b9e580 to your computer and use it in GitHub Desktop.
Create a custom WordPress shortcode that gets a file
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_shortcode() { | |
ob_start(); | |
get_template_part('custom_shortcode'); // get file custom_shortcode.php in your theme | |
return ob_get_clean(); | |
} | |
add_shortcode( 'my_custom_shortcode', 'my_custom_shortcode' ); | |
// shortcode to use [my_custom_shortcode] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment