• Hello,
    I am doing some volunteer work for a non-profit. I am not an expert by any means. I have a non-wordpress page with javascript that I need to convert to work in a wordpress page. Any fairly detailed instructions would be appreciated.

    <!DOCTYPE html>
    <html class="html"><head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <meta name="generator" content="7.3.5.244"><title>Give to Hope</title>
    
    <!-- Other scripts -->
    <script type="text/javascript">
    document.documentElement.className += ' js';
    </script>
    </head>
    <body>
    <div class="shadow clearfix" id="page">
    <div id="cpb6a6797723" style="margin: 10px 0pt;" onclick="document.getElementById('pay_now_form_f0842ddb20').submit()">
    <div>
    <form action="https://globalgatewaye4.firstdata.com/pay" id="pay_now_form_f0842ddb20" method="post"><input name="x_login" value="WSP-HOPE-Egm9@xxxxx" type="hidden"><input name="x_show_form" value="PAYMENT_FORM" type="hidden"><input name="x_fp_sequence" value="140561766910534xxxxx" type="hidden"><input name="x_fp_hash" value="PNB-1.0-d44cdf92c09d5060ca295f276ab9c6187c3xxxxx" type="hidden"><input name="x_amount" value="" type="hidden"><input name="x_currency_code" value="USD" type="hidden"><input name="x_test_request" value="FALSE" type="hidden"><input name="x_relay_response" value="" type="hidden"><input name="donation_prompt" value="Please enter the amount you wish to donate" type="hidden"><input name="button_code" value="Donate Now Hope Church" type="hidden">
    <div class="cpwrap"><button type="button">Donate
    Now</button></div>
    </form>
    </div>
    </div>
    &nbsp;
    <script type="text/javascript">if (document.location.protocol != 'https:') document.write('\x3Cscript src="http://musecdn.businesscatalyst.com/scripts/4.0/jquery-1.8.3.min.js" type="text/javascript">\x3C/script>');
    </script>
    <script type="text/javascript">
    window.jQuery || document.write('\x3Cscript src="scripts/jquery-1.8.3.min.js" type="text/javascript">\x3C/script>');
    </script></div>
    </body></html>

Viewing 1 replies (of 1 total)
  • Strip out the html, head, meta and body tags ( opening and closing ). You can drop the script tag as well that’s calling up javascript ( its at the bottom ).

    That’ll leave you with bare bones HTML content, now you need to add the header/footer calls and name the template, so this barebones should do ( not counting your HTML ):

    <?php
    
    /**
     * Template Name: My Template
     */
    
    get_header();
    
    ?>
    	<!-- Insert your HTML content immediately after this line -->
    <?php
    
    get_footer();

    Now, once that’s done save that file and drop it in your theme, name it something like page-my-template.php

    Once you do that go create a new page in WordPress and set the template to My Template – it should be in a dropdown on the right, if you did all this right.

    Boom, done! – This is a crude, and very simplistic explanation of page templates, if you get hung up, take a read at the official documentation on Page templates.

    You will undoubtedly need to clean up styling, etc, and there are MANY other ways of doing this ( considering you’re only doing a form ), but it should get you on the right track.

    Good luck – happy coding!

Viewing 1 replies (of 1 total)

The topic ‘Help putting Javascript in page’ is closed to new replies.