How can we get username into a shortcode
-
How can we use $usernamein 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 ?
-
Answer:
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: <?php echo do_shortcode('[education="$username"]'); ?> to <?php echo do_shortcode("[education=\"$username\"]"); ?>
iberx at Stack Overflow Visit the source
Other answers
You are using single quote .. Use double quote and that should work. <?php echo do_shortcode("[education=". $username. "]"); ?>
Scalable
Related Q & A:
- How Can I Get Started As A Freelance Web Developer?Best solution by code.tutsplus.com
- How can I get objects in a S3 bucket?Best solution by Stack Overflow
- How can I get out of a lease for an apartment?Best solution by Yahoo! Answers
- How can I get pictures from a video?Best solution by Yahoo! Answers
- How can I get rid of a Smart virus?Best solution by blog.teesupport.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.