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', function() {
    ob_start();
    // Start your PHP below
  
    echo 'short code example';
  
    // End your PHP above
    return ob_get_clean();
} );