• Resolved valleyfamilyfun

    (@valleyfamilyfun)


    I am not a developer and have basic knowledge.
    I am trying to make edits to the page: http://www.valleyfamilyfun.ca/calendar. however, when I add an image, or try to move anything, I lose the majority of the contents and have had to restore to an earlier version of the page.
    This particularly happens when I am trying to add a link to a google form to an image.

    I had a code block on the page that was full of javascript that would make the images rotate location (all in a different location, and would “jump around” each time you refreshed the page). This code is all gone now.
    My tech friend went in to change some code around the google calendar (also has javascript) and the page crashed, and I had restore an earlier version again.

    Which makes me think there is a javascript problem.

    Please help! remember, I am not a developer or coder!

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Try deactivating all plugins. If that resolves the issue, reactivate each one individually until you find the cause.

    If that does not resolve the issue, try switching to the Twenty Seventeen theme to rule-out a theme-specific issue (theme functions can interfere like plugins).

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    But, it only happens on that one page, and there are no plugins in use on that page.
    I just restored to a version one month ago. When I look at it, it shows the one-month-ago page, but the code block with the javascript in it does NOT appear.
    However, when I click to EDIT PAGE, it shows the data from this week.

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    UPDATE: i cleared the cache and all the images are ok now. HOWEVER, the code block with the javascript in it is still not showing up.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Where did you get the JS code from?

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    A developer gave it to me about 5 years ago and it worked PERFECTLY up until this week.

    <script language=”Javascript” type=”text/JavaScript”>
    var ad = new Array()

    ad[0]=’<div class=”squaread”></div>’
    ad[1]=’<div class=”squaread”></div>’
    ad[2]=’<div class=”squaread”></div>’
    continue on for all the ads as above.
    Word of caution: Please be very careful to add in all the symbols exactly because missing just one ‘ can make the javascript completely fall apart!
    After your list of ads copy and paste all of the information below:

    function randomorder(targetarray, spacing){

    var randomorder=new Array()
    var the_one
    var z=0
    for (i=0;i<targetarray.length;i++)
    randomorder[i]=i

    while (z<targetarray.length){
    the_one=Math.floor(Math.random()*targetarray.length)
    if (targetarray[the_one]!=”_selected!”){
    document.write(targetarray[the_one]+spacing)
    targetarray[the_one]=”_selected!”
    z++
    }
    }
    }

    </script>

    <script language=”Javascript” type=”text/javascript” ></script>
    <script>
    randomorder(ad, ‘ ‘)
    </script>

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Did it stop working right after you upgraded to WordPress 4.8.2 (released September 19), or was it working fine under WordPress 4.8.2 until last week?

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    That is a great question, and I am SURE you are right, that it was around the time of the new release! Should I uninstall the new release?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    No, definitely don’t go back. 4.8.2 included a fix for a security vulnerability, and that fix also “breaks” vulnerable JS inserted into your content.

    So, 4.8.2 did break it, but for a very good reason.

    In this case, I recommend finding a plugin that approximates the functionality you lost: https://wordpress.org/plugins/

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    Ok! so how do I get the javascript code to work, then, or is there a WP plugin that will take images and randomize them? Not one over top of the other like a slider, but vertically, changing their position on the page each time the page is refreshed?

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    To get the code to work, you’ll probably need to hire someone to write a better and more secure version, if no one else with more JS expertise comes along here. For that, please try https://jobs.wordpress.net/ or https://jetpack.pro/ and do not accept any hire or direct access offers posted to these forums.

    As for a plugin, I’m not aware of one myself, but with 52,399 free plugins available, there’s bound to be something close. I recommend searching for your criteria here: https://wordpress.org/plugins/

    Choosing a plugin, even if it’s not exactly what you want, will be far more future-proof than building custom functionality.

    Thread Starter valleyfamilyfun

    (@valleyfamilyfun)

    thanks! I will keep looking.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Page Crashing: Possible Javascript problem’ is closed to new replies.