How to add a shortcode

Shortcodes are added in the functions.php file of your theme. It is recommended doing it in child themes.
(Don't forget that the content of functions.php is added to the parent's one, create a blank file in the child's folder)
function myshortcode_func( $atts ){
    return "<b>Shortcodes are handy.</b>";
}
add_shortcode('myshortcode', 'myshortcode_func');
 
Using them is simple. Just add the name of the shortcode enclosed in brackets [myshortcode] into the post.
Additional info

Shortcode API /wordpress.org/