/**
* Post title shortcode.
* `[post_title]` to use in the loop. Or `[post_title id="123"]` to get a specific post's title, by ID
*
* @return string The post's title.
*/
add_shortcode( 'post_title', function( $atts ) {
$atts = shortcode_atts( array(
'id' => get_the_ID(),
), $atts, 'post_title' );
return get_the_title( absint( $atts['id'] ) );
});