https://codex.wordpress.org/Shortcode_API
Example from
https://gist.github.com/mattwilding/68838f5c8a40b6be7b9795889c470431
function my_shortcode_function() {
return ‘<p>This is generated by my shortcode</p>’;
}
add_shortcode( ‘my_shortcode’, ‘my_shortcode_function’ );
// enter the shortcode [my_shortcode] to your page/post content and the page/post will display “This is generated by my content” in <p> tags
Example from
function my_content_shortcode_function( $atts, $content = null ) {
return ‘<span class=”caption”>’ . $content . ‘</span>’;
}
add_shortcode( ‘my_content_shortcode’, ‘my_content_shortcode_function’ );
//enter the shortcode [my_content_shortcode]This is the text I want to format[/my_content_shortcode] into your page/post and the rendered page/post will show
// “This is the text I want to format” wrapped in <span> tags.
Sent from my Samsung Galaxy smartphone.