A word to the WordPress wise, and a whole lotta “cache”

If you’ve spent a lot of time tweaking your text in the text widgets, always remember to BACK IT UP. You may remember my ordeal with the newsletter, so imagine my surprise when I went to the website today and THE NEWSLETTER SIGNUP FORM WASN’T THERE. I went to the widgets admin panel and when I opened up that text widget, it was blank. Fortunately, I had actually pieced the code together in PSPad editor , and had saved a copy of it.

When I reloaded the main page, it still wasn’t showing up, and I remembered that the wp-cache plugin was caching the pages, so I went in and deleted the cache. Now my form was back, but I forgot that I had changed a bit of text at the bottom by hand, and it was just a little tedious html that I really didn’t want to have to redo.

Then I remembered google’s cache feature, and thought, “I wonder….”.

Sure enough the google cache page had my original form, and it was a simple matter of “view source” and copy and paste. Voilà! Everything was back to normal.

I thought about why the text disappeared in the first place, and I’ll hazard a few guesses:
1. Maybe one of the new plugins messed it up.
2. There was some style tags with css in it, along with a “comment”, well here is the code you can see for yourself:

<style>
   label
{
width: 2em;
float: left;
text-align: right;
margin-right: 0.1em;
display: block
}

.submit input
{
margin-left: 3.1em;
}
input
{
color: #007700;
background: #000000;
border: 2px solid #147
}

.submit input
{
color: #007700;
background: #000000;
border: 2px outset #147
}
fieldset
{
border: 2px solid #147;
width: 11em
}

legend
{
color: #147;
background: #000000;
border: 2px solid #147;
padding: 2px 6px
}
</style>

<script language="Javascript" type="text/javascript">
var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}

</script>
<fieldset>
<legend><B>Newsletter</B></legend>
 <table>
      <tr>
           <td><form method="post" action="http://www.daveryder.com/newsletter/?p=subscribe&id=1" name="subscribeform">
Email:
           </td>
           <td><input type="text" name="email" value = "">
           </td>
      </tr>

      <tr>
           <td><script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
First Name:
           </td>
           <td><input type="text" name="attribute1" value = "">
           </td>
      </tr>

      <tr>
           <td><script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>

Last Name:
           </td>
           <td><input type="text" name="attribute2" value = "">
           </td>
      </tr>

       <tr>
           <td>
           </td>
           <td><script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Name");</script>

<input type="hidden" name="list[2]" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>
           </td>
      </tr>
      <tr><td colspan="2"><BR>
    <font color="red"><B>I hate spam</B>.</font><BR>
    I respect your privacy. I will not share your email address with anyone, ever.<BR>
</td></tr>

  </table>
</fieldset>

<!-- newsletter subscribe ends here --></div>

What I’ve done now is remove the comment, and put the CSS in the theme’s style sheet (where it should have been to begin with) - maybe that will stop this from happening again :-) .

Leave a Reply