-1

Here is my shortcode:

[contact-form-7 id="1735" title="Contact form 1"]

To execute it, I need it in links (Ex.http://html.com). How to convert this short code to link? Is it possible?

4
  • Welcome to WordPress Development. Can you please elaborate futher, I'm not sure what you're asking exactly. Thanks
    – birgire
    Commented Mar 1, 2017 at 10:09
  • Thank you. I need to have popup contact form in my wordpress theme. So on clicking some button need to popup that form. In wordpress it is asking for link(mean some example.com) to open popup. In my plugin it gives only short code. I need link instead of short code.
    – Jeevan RL
    Commented Mar 1, 2017 at 10:22
  • I'm not sure if that's supported by the plugin? Did you try the plugin support forum? Note that 3rd party plugins are in general off-topic here, unless the questions can be rewritten in a way that no special knowledge of that plugin is needed to answer. Please add all the extra info, including what you've tried so far and research made, as an edit to the question, thanks. Best of luck.
    – birgire
    Commented Mar 1, 2017 at 10:29
  • What if the shortcode is inserted in a page and the page permanent link added as a link in the button? Commented Apr 23, 2021 at 19:08

1 Answer 1

2

Wrap your shortcode in a div and give it an ID that you can use as a target when triggering your popup. For example, you can put the shortcode somewhere on your page (content, sidebar, etc) as follows:

<div id="popup" class="lightbox">[contact-form-7 id="1735" title="Contact form 1"]</div>

and the link that trigges the popup will look something like

<a href="#popup">Form</a>

You might have to use do_shortcode() in some cases, depending on where and how you add the shortcode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.