Skip to content

Instantly share code, notes, and snippets.

@justinallen
Created September 13, 2018 20:35
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 justinallen/c7296144ee990865f9c7b2f4fddbcc1a to your computer and use it in GitHub Desktop.
Save justinallen/c7296144ee990865f9c7b2f4fddbcc1a to your computer and use it in GitHub Desktop.
simple boilerplate wordpress shortcode
/**
* Boilerplate WordPress shortcode - can drop into functions.php
* Use: [bananify this="thing to add a banana to"]
*/
function bananify_func( $atts ) {
$a = shortcode_atts( array(
'this' => 'something'
), $atts );
$str = "<h1>";
$str .= $a['this'];
$str .= " banana";
$str .= "</h1>";
return $str;
}
add_shortcode( 'bananify', 'bananify_func' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment