Last active
September 3, 2020 13:06
-
-
Save versluis/d945397b3deffc96bffd26d012107ab4 to your computer and use it in GitHub Desktop.
Creating basic Shortcodes in WordPress
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
<?php | |
// create your shortcode function | |
function guru_my_shortcode() { | |
// do something here | |
// return text you want to display | |
return $output; | |
} | |
// register all shortcodes | |
function guru_shortcodes() { | |
add_shortcode( 'your-handle', 'guru_my_shortcode' ); | |
} | |
add_action( 'init', 'guru_shortcodes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment