You can try this shortode in this plugin file or you can paste this method to bottom of active theme’s functions.php
. If you are new to WordPress and need a help you can visit here for steps to add code in function.
add_shortcode( 'my-awesome-button', 'wp_my_awesome_bytton' );
function wp_my_awesome_bytton( $atts ) {
$button_html="";
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$button_html="<a href="https://direktoriku.com/shopping/?user=" . esc_attr( $current_user->user_login ) . '"><button>Click me</button></a>';
}
return $button_html;
}
// Use this shortcode anywhere in page/post content like this: [my-awesome-button]
it will replace your shortcode to html code. More information about shortcode visit here.