Hyperlink URL with meta box shortcode

Support General Hyperlink URL with meta box shortcode

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #6668
    janekjanek
    Participant

    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?

    #6669
    Truong GiangTruong Giang
    Participant

    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.

    #6670
    janekjanek
    Participant

    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.

    #6673
    Truong GiangTruong Giang
    Participant

    Hi,

    You can insert this to widget:
    <a href="[rwmb_meta meta_key="url_1" ]">[rwmb_meta meta_key="url_1" ]</a>

    Thank you.

    #6674
    janekjanek
    Participant

    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.

    #6684
    Truong GiangTruong Giang
    Participant

    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.

    #6687
    janekjanek
    Participant

    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>

    #6689
    janekjanek
    Participant

    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/

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Hyperlink URL with meta box shortcode’ is closed to new replies.