• Resolved Kyrian

    (@oloccina)


    Hello I have a shortcode printing an url http://mysite.com

    When I use it like this

    <p><a href="[sc name="partner link"]" target="_blank" rel="noopener">[sc name="partner link"]</a></p>

    the code inside the href tag gets messed up and in frontend I see this

    <a href="<!-- Shortcoder conditions not met -->" target="_blank" rel="noopener noreferrer">https://mysite.com</a>

    Could you fix the plugin so that shortcodes can be used inside href tags as well? I think the problem could be the double quotes around the shortcode name, because I tested this with shortcodes generated by another plugin, which do not have the double quotes, and it works.

    Thank you

    • This topic was modified 6 years, 7 months ago by Kyrian.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @oloccina,

    Shortcoder prints <!-- Shortcoder conditions not met --> text when the shortcode has some conditions set like “show in mobile/desktop” only, “disable for administrators”, ” temporarirly disable” etc.

    When any of the above condition is set and if the condition is not met, then the above quoted comment tag will be printed.

    In your case that comment tag is being printed and that is the issue.

    The best way to implement your requirement is like below. The method you are following is not expected.

    Please use “custom parameters” feature where you can pass parameters for a shortcode.

    Shortcode content:

    <a href="%%link_url%%" target="_blank" rel="noopener noreferrer">%%text%%</a>

    Use shortcode like this:

    [sc name="partner link" text="My site" link_url="http://mysite.com" ]

    Thanks,
    Aakash

    Thread Starter Kyrian

    (@oloccina)

    Hello,
    My problem is that with your solution I have to manually insert the website link in frontend when using the shortcode.

    The whole point of using a shortcode is to be able to then change just the shortcode in backend to have all the frontend values being changed automatically.

    this is why I think I need to so something like this:
    Shortcode content:

    <a href="http://mysite.com" target="_blank" rel="noopener noreferrer">some text</a>

    Use shortcode in frontend:

    [sc name="partner link"]

    If I have this in frontend
    [sc name="partner link" text="My site" link_url="http://mysite.com" ]
    then I have to manually change the link_url value for every instance of the shortcode I have around the site whenever I have to change the link

    Thanks

    • This reply was modified 6 years, 7 months ago by Kyrian.
    • This reply was modified 6 years, 7 months ago by Kyrian.
    Thread Starter Kyrian

    (@oloccina)

    Alright,
    I was able to solve like this

    <a href="[net_partner_camtv]" target="_blank" rel="noopener noreferrer">%%text%%</a>

    Thank you

    Plugin Author vaakash

    (@vaakash)

    Cheers !

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘shortcodes do not work when used as href parameter’ is closed to new replies.