A few months ago I broke down and implemented WordPress in to my site. After the initial pain of dealing with their ...undesirable code I was pretty sure I had everything relatively smoothed out.
Turns out today when I received an award (with more website difficulties or maybe it's permissions) I posted about it on my blog and I get the following genius XHTML output...
<img src="image/badge.png" /></p>
Now granted that's not the exact code but there was no paragraph before the image. I goof up my XHTML on occasion (I serve it as application/xhtml+xml for XHTML capable browsers and XHTML 1.0 Strict && text/html for the rest) so I'm no stranger to broken XHTML errors (I take a strong stance against crappy code, most especially when it works as desired but it's total trash any way! The whole Microsoft monopoly street...etc you know).
So any way I copied everything to notepad, slowly added stuff back, and just could not for the life of me find anything wrong with my code. So I left my main current registration project's DB in PhpMyAdmin and went to the WordPress database to see if the script decided to "enhance" my code. Well everything looked fine and peachy.
So I fired up Advanced Find and Replace and started looking for string replacements which brought me to wp-includes/formatting.php. An hour later everything seems fine in Firefox.
So maybe an hour later I find the need to check something in Opera and low and bef@$%ing-hold the XHTML in Opera is broken! So I go back to Firefox, disable the cache with the Web Developer toolbar (Chris Pederick is the man for saving me so much time) while ensuring the page is being loaded by using the http query mediatype=xx. Well everything was fine in Firefox but the same problem that was occurring in Firefox in my post was now only occurring in Opera.
I'm not aware of how to disable cache in Opera (or if it's even an option) but after commenting more $pee (gah..I kid you not!) in the same file I noticed that the bottom of the page would break instead. So something really goofy was going on! So I blew an hour of my life trying to comment out various things.
I was at a stalemate staring the beast directly in the uh, pixel. I didn't have time for this, I have milk and cookies waiting for me to ease the burn of my now misapplied Red Bull! As I was looking at the source code and trying to find closing body and html elements (the last issue once I commented certain $pee out (*sigh*)) it might be a template issue...even though nothing was being found in any of my string searches in Advanced Find and Replace.
So I loaded up the footer template and then it struck me...something is broken deep in WordPress that is spitting out the footer or something twice. It had nothing to do with string replacements of the ending body and ending html elements. So I calmly placed exit (); at the end of the template, saved, uploaded, reloaded, and sighed relief.
Eventually when I get experienced enough I'll write my own blog scripts and such but for now I have much more important things to be concerned about such as securing a steady stream of Red Bull, milk, and cookies. A guy's gotta eat after all and if there is a moral to this story it only emphasizes what all the bad guys have always repeated in all those movies: if you want something done right, do it yourself!
<flame />
WordPress Flame Thread with funny PHP solution. >__>
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact: