Yesterday I wrote a javascript to add umlauts to text. I had a few issues. One was that the umlauts were appearing next to the letters instead of on top of them. I found this was a bug with the Courier New font, which is used as the default font for textboxes (on Chrome in Win7 anyway): Re: problem with combining diacritcs in HTML5
Next I had a problem with getting an error message about
$ is not defined(I was using jQuery). But when I paused the script in the console just before the error, I checked the value of $, and it was defined. This had me stumped for a while.
The error actually was correct, it seems that the default wordpress themes (twentyeleven and twentytwelve themes) don't include jQuery. (Quite sensible not to include a js library if its not needed). The reason that $ appeared to be defined in Chrome's console is that the console has some built-in js it loads, which includes $ for selecting elements (with jquery style syntax I think). So $ was defined in the console, but not in the actual page (and $ wasn't jQuery). The solution was simply to create a child theme that enqueued jquery in the functions.php file.
Another problem (that I haven't fixed) is that Korean, Chinese characters etc. don't appear to have the umlauts added correctly. I am pretty sure that this is another issue to do with the textbox or font used.
Today I was mostly working on an article for my photo tips website. (I was doing some of that yesterday as well).
No comments:
Post a Comment