Creating a Shortcode

The PHP snippet below provides an example to use [my_shortcode] to output text string of “short code example”:

add_shortcode( 'my_shortcode', 'tu_my_shortcode' );
function tu_my_shortcode() {
	ob_start();
	// Start your PHP below
  
	echo 'short code example';
  
	// End your PHP above
	$ret = ob_get_contents();
	ob_end_clean();
	return $ret;
}