add_shortcode( ‘my_first_name’, function ( $atts ) {
$current_user = wp_get_current_user();
if ( ! ( $current_user instanceof WP_User ) ) return;

$atts = array_change_key_case( (array) $atts, CASE_LOWER );

extract( shortcode_atts( array(
‘display_tag’ => ‘h2’,
), $atts ) );

$o = ‘

‘;
$t = $display_tag ? $display_tag : ‘h2’; // Just in case.
$o .= ‘<' . $t . '>‘ . esc_html__( $current_user->user_firstname ) . ‘‘;
$o .= ‘

‘;

return $o;
} );

Shopping cart

0
image/svg+xml

No products in the cart.

Continue Shopping