Skip to content

Instantly share code, notes, and snippets.

@versluis
Last active September 3, 2020 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save versluis/d945397b3deffc96bffd26d012107ab4 to your computer and use it in GitHub Desktop.
Save versluis/d945397b3deffc96bffd26d012107ab4 to your computer and use it in GitHub Desktop.
Creating basic Shortcodes in WordPress
<?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