Php code inside wordpress do_shortcode
-
Hi
I want to add a php code inside the wordpress do shortcode
The shortcode [link] is a mycred shortcode which gives users points when they click on a link. However I want to give my users link when the share a post on facebook so I have used the code below, but it did not work<?php echo do_shortcode( '[link href="http://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode(get_permalink()); ?>"]View portfolio[/link]'); ?>I tried the above code but it didn’t work. It didn’t recognize the php code after the facebook share link. See the URL it shows below
http://www.facebook.com/sharer/sharer.php?u=%3C?php%20echo%20urlencode(get_permalink());%20?%3E
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Php code inside wordpress do_shortcode’ is closed to new replies.