Support Forum
Hi, I'm having trouble with with the URL meta box shortcode.
My idea is to enable authors to create a list of links to accompany a page or post however when I use the shortcode to display the URLs they do not display as a hyperlink, instead they are just listed as plain text.
The shortcode I'm using is
[rwmb_meta meta_key="url_1" ]
Is there a simple fix to enable hyperlinking?
Hi there,
Do you means https://metabox.io/ instead of https://metabox.io/?
You can use this code: echo make_clickable( do_shortcode( '[rwmb_meta meta_key="url_1" ]' ) );
Thank you.
Sorry my knowledge of coding is pretty bad.
Currently I have the shortcode sitting within a widget that appears on a sidebar on my site. If I add the code you supplied to the widget it will not work.
You can see an example of what I've achieved within the sidebar/widget with the original shortcode.
http://7c79b000.ngrok.io/academy-sports/tennis/
Sorry for the slow connection, just a temp site at the moment.
If I use your code, where would I need to put it to affect the shortcode within the widget. Or is there another approach I can take to achieve the same result.
Hi,
You can insert this to widget:
<a href="[rwmb_meta meta_key="url_1" ]">[rwmb_meta meta_key="url_1" ]</a>
Thank you.
Hi Truong,
That code within the widget seems to just turn the URLS to
http://swas.dev/academy-sports/tennis/%5Brwmb_meta%20meta_key=
instead of http://www.google.com for example.
Oh so sorry, I have a mistake. Please try the code below:
<a href='[rwmb_meta meta_key="url_1"]'>[rwmb_meta meta_key="url_1"]</a>
And you should switch the editor to text mode instead of visual mode.
No worries. Still having problems with this.
Using the code above both links (google.com and googlemaps.com) forward to
http://www.googlemaps.com%3C/li%3E%3C/ul%3E
Complete code for the widget looks like:
<xmp>
<h4>Application and Information Forms</h4>
[rwmb_meta meta_key="applications_forms" type="file-advanced"]
<h4>Links</h4>
[rwmb_meta meta_key="url_1"]</xmp>
Disregard the xmp. Trying to figure out how to display the code without it actually running the code.
Should be able to see the code I'm using via the following link
https://jsfiddle.net/f9et2en3/