How can we use $username
in a shorcode
<?php echo do_shortcode('[education="$username"]'); ?>
But it doesn't work
I have a shortcode as [education="username"]
. It works manually [education="john-doe"]
I want to get username into my shortcode on user profile page
<?php echo do_shortcode("[education="username"]"); ?>
But it's not working. What am I missing ?
In php, single quoted strings don't support variable interpolation. Change from single quotes to double quotes. The double quotes inside your string will need to be escaped.
Change:
to