Dan
asked on
using a shortcode inside a link in wordpress
How do I use a short code inside a link, I have a shortcode [ThisURL] and that returns the URL of the current page.
However if I have the code:
<a href="https://www.facebook.com/sharer/sharer.php?u=[ThisURL]">Share on Facebook</a>
This then makes a link to:
https://www.facebook.com/sharer/sharer.php?u=[show-jagged-ThisURL]
and not as I would like:
https://www.facebook.com/sharer/sharer.php?u=my-website.com
However if I have the code:
<a href="https://www.facebook.com/sharer/sharer.php?u=[ThisURL]">Share on Facebook</a>
This then makes a link to:
https://www.facebook.com/sharer/sharer.php?u=[show-jagged-ThisURL]
and not as I would like:
https://www.facebook.com/sharer/sharer.php?u=my-website.com
ASKER
Nathan,
Thank you. Sorry for the novice questions but:
Which template file do I change (theme twentysixteen) and what controls when this is added to the page/links.
Thanks
Thank you. Sorry for the novice questions but:
Which template file do I change (theme twentysixteen) and what controls when this is added to the page/links.
Thanks
No worries, are you placing this link on a detail page? Such as a blog detail page?
ASKER
I have a post and I have added a link to share on Facebook, but Facebook wants you to pass the URL to share and that was the issue.
Got it. Can you link me?
You added this in the post content for just this post? I assume you'll want this on all article pages so your content can be shared right? If that's the case I can point out what template file to modify.
You added this in the post content for just this post? I assume you'll want this on all article pages so your content can be shared right? If that's the case I can point out what template file to modify.
ASKER
No not on all pages I want to be able to chose which pages and which points I add the code is that possible. Can you make the output of a short link go inside a herf?
ASKER
I would also like the post writer to be able to use short codes in URLs they place on the page without having to access the php side of the server. Can it be done?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
It will grab your current page URL and drop it in as needed.