Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter Brenda

    (@brennie369)

    We’re getting closer! It loads the daily quote now, but seems to render the daily affirmation to not work (it stays on “…loading today’s affirmation”).

    Edit: So I tried changing the code in both boxes to the new one but then it shows the quote in both (I did change the file path).

    • This reply was modified 6 years, 7 months ago by Brenda.
    Thread Starter Brenda

    (@brennie369)

    OK a new weirdness is happening. Now when I have both widgets on the page, the Affirmations widget is displaying the daily quote instead of the daily affirmation, and the quote box is displaying the “…loading today’s quote”. This is without any changes to the code. Before with no changes to the code, the affirmations showed the daily affirmation and the quote displayed the “…loading today’s quote”.

    On an off-topic note, my avatar in this forum isn’t showing. It’s showing the pixel image, even though my avatar is current on Gravatar. Non-related & not important!

    Thread Starter Brenda

    (@brennie369)

    I tried removing the two lines with ID but that didn’t work, so I put them back. I see where to I place the ClassName line. How do I edit the first line where it says <div id=’msgHere’> (I’m not familiar with javascript – just HTML & CSS). On that note, if I use a class do I need to add something to the CSS?

    • This reply was modified 6 years, 7 months ago by Brenda.
    Thread Starter Brenda

    (@brennie369)

    I edited my post code above and it seems to be showing it all now.

    Thread Starter Brenda

    (@brennie369)

    <div id='msgHere'>
    ...loading today's quote</div>
    
    <script type='text/javascript'>
    
    var xmlhttp = null;
    
    function AjaxRequest(url){
      if(xmlhttp != null){
        if(xmlhttp.abort)
          xmlhttp.abort();
        xmlhttp = null;
      };
      if(window.XMLHttpRequest) // good browsers
        xmlhttp=new XMLHttpRequest();
      else if(window.ActiveXObject) // IE
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    
      if(xmlhttp == null)
        return null;
    
      xmlhttp.open("GET",url,false);
      xmlhttp.send(null);
    
      if(xmlhttp.status >= 200 && xmlhttp.status < 300)// 2xx is good enough
        return xmlhttp.responseText;
      else
        return null;
    }
    
    function clearEle(element){
      while(element.hasChildNodes())
        element.removeChild(element.firstChild);
    }
    
    window.onload = function(){
      var el, msg, date1, date2, txt = AjaxRequest('/files/quotes.txt');
      date2 = new Date();
      date2.setFullYear(2011);// year to begin
      date2.setMonth(5);// take 1 from the month number
      date2.setDate(6); // date of month
    
      if(txt == null)
        msg = 'page not found or Ajax not supported by your browser.';
      else{
        msg = txt;
      }
      date1 = new Date();
    
      txt = msg.split("\n");
      date1 = Math.floor(date1.getTime() / (24*60*60*1000));
      date2 = Math.floor(date2.getTime() / (24*60*60*1000));
    
      if(date1 > date2){// swap them around? -- replace with another method?
        var tmp = date1;
        date1 = date2;
        date2 = tmp;
      };
    
      el = document.getElementById('msgHere');
    
      clearEle(el);
      el.appendChild( document.createTextNode(txt[(date2-date1)%txt.length]));
    }
    
    </script> 

    The steps taken are just adding the Custom HTML widget then pasting this code into it and giving it the title Daily Quotes 2 (I currently do have a plugin one on the page until I can get this one to work). All it does it display the Ajax message, “…loading today’s quote”. This code was copied from my old/original static HTML page where it did work (I recently converted from a static HTML site to WordPress).

    I’ve even copied the code from the Daily Affirmations Custom HTML widget (because they’re identical) and changed the link and Ajax message, but that had the same result. The Affirmations one works, this one doesn’t. I even copied and pasted the Affirmations code and didn’t change anything, with the same result.

    • This reply was modified 6 years, 7 months ago by Brenda.
    • This reply was modified 6 years, 7 months ago by Brenda.
    • This reply was modified 6 years, 7 months ago by Brenda.
    Thread Starter Brenda

    (@brennie369)

    I’ve had the custom HTML for years created by a friend. The reason I’d rather use this instead of a plugin is because it allows me to hand-select the content that’s displayed. I don’t have control over them if it’s a plugin.

    Thread Starter Brenda

    (@brennie369)

    The problem was one of the plugins.

    Thread Starter Brenda

    (@brennie369)

    Ok will try those, thanks!

    Thread Starter Brenda

    (@brennie369)

    I’m hosting through InMotion Hosting on a shared server. It is a Linux server using Apache, PHP, and MySQL. My server info:

    cPanel Version 68.0 (build 39)
    Apache Version 2.4.33
    PHP Version 7.0.29
    MySQL Version 10.2.12-MariaDB-log
    Architecture x86_64
    Operating System linux
    Perl Version 5.10.1
    Kernel Version 2.6.32-896.16.1.lve1.4.49.el6.x86_64

    • This reply was modified 6 years, 7 months ago by Brenda.
    Forum: Fixing WordPress
    In reply to: Line break
    Thread Starter Brenda

    (@brennie369)

    That’s what I tried first but it wasn’t working, so then I tried [br] which also didn’t work. I ended up adding a space between the lines. I am wondering if it’s because I am using columns, as I haven’t run into this problem on any other pages.

    Can you change the topic on the post(s) or page(s) associated with it, in the interim, until you can delete it?

    Thread Starter Brenda

    (@brennie369)

    Ok got it, thanks!

    Thread Starter Brenda

    (@brennie369)

    I have access to the database. I was hoping there was a place to download the content because it’s over 200 pages.

    Thread Starter Brenda

    (@brennie369)

    Ok thank you, I appreciate the response.

Viewing 14 replies - 1 through 14 (of 14 total)