1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress help...

Discussion in 'Content Management' started by Carl05, Nov 17, 2016.

  1. #1
    Carl05, Nov 17, 2016 IP
  2. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #2
    I would have to crawl in there perhaps but have you tried to simply toggling the visual editor to html mode? Do that and click save without using the visual editor.

    That may be a javascript conflict as well.

    EDIT: This could be the isssue [cycle] terminating; zero elements found by selector

    That is a new one on me. I don't quite understand that issue.

    Let me know. Happy to help.
    Nigel
     
    Last edited: Nov 17, 2016
    Nigel Lew, Nov 17, 2016 IP
  3. Carl05

    Carl05 Well-Known Member

    Messages:
    586
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Hi Nigel.
    I'm brand new to wordpress, so not fully understanding what yo have said there..

    How I added this was, when i added a page, there's 2 sections, visual and text.... I copied the html (including the script) into the text section

    Thanks for looking
     
    Carl05, Nov 17, 2016 IP
  4. Carl05

    Carl05 Well-Known Member

    Messages:
    586
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #4
    heres the code I'm trying to add as a wordpress page .. works ok as html

    <!DOCTYPE HTML>
    <html>
    <head>

    <script type="text/javascript">
    var price=new Object();
    price.year_adult=24;
    price.year_child=12;
    price.session_adult=3;
    price.session_child=2;
    price.training_adult=30;
    price.training_child=24;
    price.insurance_adult=25;
    price.insurance_child=15;
    price.badges_adult=2;
    price.badges_child=2;
    price.subs_adult=3;
    price.subs_child=2;
    price.equipment_adult=2;
    price.equipment_child=2;

    function calculate_fee()
    {
    var total=0;

    var age_group='child';
    if(document.getElementById('adult_field').checked)
    {
    age_group='adult';
    }

    // subtract passed months from full year
    var selected_month=document.getElementById('month_field').selectedIndex;
    var remaining_months=12-selected_month;
    if(selected_month<9) // Months are counted from zero in javascript, so September is 8.
    {
    total+=price['year_'+age_group]/12*remaining_months;
    var pro_rata=total+' ('+remaining_months+' months)';
    }

    // after September the next full year is added too
    else
    {
    total+=price['year_'+age_group]+remaining_months;
    var pro_rata=total+' ('+(remaining_months+12)+' months)';
    }
    document.getElementById('year').innerHTML=pro_rata;

    var extras=document.getElementsByClassName('extras');
    var result=document.getElementsByClassName('result');
    for(var i=0; i<extras.length; i++)
    {
    if(extras.checked || extras.value=='checked')
    {
    result.innerHTML=price[extras.id+'_'+age_group];
    total+=price[extras.id+'_'+age_group];
    }
    else
    {
    result.innerHTML=0;
    }
    }
    document.getElementById('session').innerHTML=total;
    }
    </script>
    </head>
    <body>
    <div id="body">
    <div id="content">
    <div id="section">
    <table>
    <tr>
    <td>
    Date of joining
    <select id="month_field">
    <option>January</option>
    <option>February</option>
    <option>March</option>
    <option>April</option>
    <option>May</option>
    <option>June</option>
    <option>July</option>
    <option>August</option>
    <option>September</option>
    <option>October</option>
    <option>November</option>
    <option>December</option>
    </select>
    </td>
    <td><input type="radio" name="age" id="child_field" value="child">Age 10-15</td>
    <td><input type="radio" name="age" value="adult" id="adult_field" checked>Age 16+</td>
    </tr>
    <tr>
    <td>Membership, yearly</td>
    <td>£12</td>
    <td>£24</td>
    </tr>
    <tr>
    <td><input type="checkbox" class="extras" id="training">Training, 6 weeks</td>
    <td>£24</td>
    <td>£30</td>
    </tr>
    <tr>
    <td>
    <input type="checkbox" disabled checked>
    <input type="hidden" class="extras" id="insurance" value="checked">Insurance, yearly
    </td>
    <td>£15</td>
    <td>£25</td>
    </tr>
    <tr>

    <td>
    <input type="checkbox" disabled checked>
    <input type="hidden" class="extras" id="badges" value="checked">Badges, quarterly
    </td>
    <td>£2</td>
    <td>£2</td>
    </tr>
    <tr>
    <td>
    <input type="checkbox" disabled checked>
    <input type="hidden" class="extras" id="subs" value="checked">Subs, weekly
    </td>
    <td>£2</td>
    <td>£3</td>
    </tr>
    <tr>
    <td><input type="checkbox" class="extras" id="equipment">Equipment, weekly</td>
    <td>£2</td>
    <td>£2</td>
    </tr>
    </table>

    <p><input type="button" value="Calculate Fee" onClick="calculate_fee();"></p>

    <h3>&nbsp;</h3>
    <h2>Total On first day: £<span id="session">0</span>.</h2>
    <h3>Breakdown</h3>
    <p>Pro Rata Membership: £<span id="year">0</span> (Annually, due every January) <br>
    Training 6 Weeks: £<span class="result" id="training_fee">0</span> (One Off Payment) <br>
    Insurance: £<span class="result" id="insurance_fee">0</span> (Annually, due every September) <br>
    Badges: £<span class="result" id="badges_fee">0</span> Quarterly. <br>
    Subs: £<span class="result" id="subs_fee">0</span> Weekly <br>
    Equipment Hire: £<span class="result" id="equipment_fee">0</span> (Weekly, when needed) </p>
    </div>
    </div>
    </div>

    </body>
    </html>
     
    Carl05, Nov 17, 2016 IP
  5. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #5
    That is javascript actually. I grabbed the code. I will try to get that working in wordpress in a sec. on my dev. server.
     
    Nigel Lew, Nov 17, 2016 IP
  6. Carl05

    Carl05 Well-Known Member

    Messages:
    586
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #6
    right .. fixed it...

    evidently, wordpress automatically blocks javascripts etc for security, so had to install a plugin called
    Scripts n Styles
    then just copied the script into there and added the shortcode to the page

    thanks for your help
     
    Carl05, Nov 17, 2016 IP
  7. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #7
    Nigel Lew, Nov 17, 2016 IP
  8. Chad Portnova

    Chad Portnova Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    I have a free WordPress video training website that helps you with WordPress and cPanel. Maybe this would help you. Please let me know how we can help you? https://www.wpvideotraining.org
     
    Chad Portnova, Jan 30, 2017 IP