Flarnie Marchán

Hello! I'm a software engineer with a passion for the web.

Shaggy Dog Story

Published Thu Jan 19 2012 00:00:00 GMT-0800 (PST)
I just have to rant for a moment about my . . . adventure with trying to add a new widget area to a WordPress theme. So, I'm currently working on a custom WP theme for my Sweetie. I want it to be PERFECT. And I am using this project as an excuse to really roll my sleeves up and get started learning about the WP API, and digging into PHP while I'm at it. I started with two widget areas, and easily added a third using the approach outlined in Justin Tadlock's Tutorial. After fiddling around with some other parts of the theme, I wanted to quickly add a fourth widget area in the footer. I followed the same steps to add a fourth widget but . . . Nothing happened. The widget area didn't appear on the dashboard or on the theme; not even in the rendered HTML code. I tried renaming IDs and classes, thinking I had accidentally caused a conflict. I tried googling around, reading about issues folks have had with the dynamic_sidebar() function... Nothing had much of an effect. Actually, nothing had any effect. After spending most of the afternoon on this problem, I gave up for the day, vowing to regroup and attack the problem in the morning. I awoke with a fierce commitment to try EVEN HARDER and read everything I could find, and to post my problem on stack exchange if I couldn't find the solution by lunch time. The morning dragged on; again, nothing worked. I tried variations of every factor, testing each part as I went. According to everything I had read and seen it should have worked, but it didn't. As lunch approached, I started writing up an explanation of the problem to post on stack exchange.  On a whim I then tried adding a small feature to the existing widget areas. I added the 'description' attribute, which is new since WP 2.9. And again, it didn't show up. Nothing changed. That's when I knew something was up.  The simplest adjustment didn't work, so there was something amiss OUTSIDE of my code.  Why didn't I think of that before? I checked and double-checked the files through the 'editor' on the WP dashboard, and the changes I tried to make were not reflected in the website or the rendered HTML. Next I opened up FTP and looked at the files on the server. None of the changes I had been making were saved on the server. Somehow during the previous day, the read/write permissions on the server had been changed. (Don't ask me how, at this point I'm just glad I figured it out and got it fixed!) With the permissions fixed, I was able to add the fourth widget area in 20 minutes!  It took no time at all now that I have MEMORIZED EVERY DARN THING about widget-area-implementation in WP 3.0. Well. From this I learned three things:
  • Don't always assume you are doing something wrong.
  • If something doesn't work, try the most basic test-case possible.
  • It's probably best to edit theme files locally and use FTP to upload them, rather than relying on the 'editor' on the dashboard. (Although the 'editor' IS super-handy!)