0

I never used SharpSpring ever, and never really added JavaScript straight into the native editor before, usually have a plugin for what I need. What would be the best practice in adding this into my page.

    <!-- SharpSpring Form for Contact Us  -->
    <script type="text/javascript">
    var ss_form = {'account': 'M7M0MDQ3BwA', 'formID':'M7EwNEkyNE3WNTBPNdI1SUox0U00SrTUTbNMS00ySTIxtzAyBAA'};
    ss_form.width = '100%';
    ss_form.height = '1000';
    ss_form.domain = 'app-AUG8DBZI.sharpspring.com';
    // ss_form.hidden = {'Company': 'Anon'}; // Modify this for sending hidden variables, or overriding values
    </script>
    <script type="text/javascript" src="https://koi-AUG8DBZI.sharpspring.com/client/form.js?ver=1.1.1"></script>

I tried looking into many different tutorials, but when I try to hook using wp_enqueue_script() method into my function.php my theme craps out. Not sure what I am doing wrong and looking for guidance on how to add this in to the native editor, and the reason behind it.

1
  • Try your theme's footer.php, or the page template. Commented Aug 3, 2015 at 15:05

1 Answer 1

1

If you open that script you can see it uses document.write() to insert an iframe in the page.

Since document.write() needs to be used at the exact location in the source where the element needs to be inserted you can't register this script through wordpress.

My suggestion would be create a short code that can be utilized in WP Admin to instert this form and add the appropriate short code function to add the script tags to the page.

Also note that document.write() is also considered a security hole

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.