On Early Morning Coding

Well, that was a frustrating two hours of working with PHP code. :-/

Our story began last week; I changed my blog’s theme to Tarski, which I ran with for a while and really liked. (To be honest, I don’t even remember why I changed.)

Tarski is not easy to work with under the hood, however. Oh, it’s easy to restyle things with CSS, but adding pieces and taking pieces away is difficult.

At least, it used to be. There was, in the version I used, a file called constants.php where extra code could be placed, but I could never figure out how to get that to work. The code wasn’t quite php.

Now it’s a little different. There are “theme hooks” that a plugin can call.

Could I add a copyright notice to my footer? I wondered. I found a sample plugin that changed the footer text, the “Powered by WordPress and Tarski” bit at the bottom of the page. I took that plugin, added the php call for a copyright notice, uploaded, and…

It worked. Not quite the way I wanted it to work, but that was easily fixed.

Using the same logic, I was able to put my Opera Widgets call in the browser address bar. (If you’re not running Opera, you won’t see anything. If you are running Opera, you can read my blog through an Opera widget. I don’t know why you’d want to, but the option is there.) Voila!

That worked, too.

Could I replace the navigation bar with a dropdown menu? It would make for a better organization of pages. Again, I looked at a sample plugin. I looked at a theme that had dropdown menus coded, and borrowed from its code. The logic? Remove the Tarski navbar and replace it with this dropdown menu code through the plugin.

I activated it.

I had a giant mess on the screen. It turned out I’d made a typo in my CSS, and nothing was picking up the CSS formatting correctly. That was an easy fix; a search-and-replace took care of it right off.

Second try.

It worked. Sort of.

It didn’t work with Opera at all. At least, not in any useful fashion. (The menu would drop down, but then it would never go away. And it looked like crap.) In Firefox it did work. But it wasn’t formatted properly.

I think my early successes inflated my sense of what I could do.

Oh, I’ll lick this problem. I will kick it to the curb and make it cry for its mother.

Though not today. I have other things to get done today.

4 thoughts on “On Early Morning Coding

  1. Ah, I know the feeling too well. I love, love Milo 317’s themes. She brings an artistic flare to her themes that few attempt. The thing is, the code underneath is fairly advanced (she knows her stuff), so I feel a little lost in trying to customize it. It also doesn’t help that her stylesheets file text comes across missing the line breaks in WordPress’ editor; I’m guessing she programs her stuff in Linux and something gets lost in the translation, because the code runs together, which can be maddening to edit.

    The latest theme I use, Rebel Magazine, has some quirks, but was dead-easy to configure out of the box and the CSS file looks refreshingly normal.

    The other night I spent an hour working with plug-ins in trying to get a Flickr feed looking how I wanted on the Rebel theme, only to learn you could use their straight “Badge” code, which had me finish the job in 5 minutes once I found it.

    You’ve got to love WordPress. ๐Ÿ˜†

  2. I looked at Rebel Magazine about a month ago. I needed some ideas for a magazine-style layout, and that was one that caught my attention. I’m not sure if I downloaded it or not. I’m thinking not.

    There are some really challenging themes out there. I always thought Kubrick, the WordPress default theme, was baffling under the hood. It’s not made to be tinkered with. ๐Ÿ™‚

    What makes Tarski challenging is the way it uses custom functions. So where you’d look for a standard WordPress call, Tarski uses a replacement call instead. The Navbar below the header graphic, for instance, doesn’t use the standard list_pages call. What it uses is a lot more complicated than that. Is it better? I don’t know. What I ended up doing, instead of trying to disable the custom call with a list_pages call that had a drop-down menu for subpages, was to reorganize my top-level pages.

    Or take adding the copyright notice to the footer. In a different theme, I’d simply have placed the copyright notice right into footer.php. But footer.php calls a special Tarski function, so I had to disable the Tarski footer credit function and replace it with one that outputted the footer credit (because that’s just good form) and the copyright function call. It works. Now that I understand it, there’s some elegance to it, as I didn’t have to modify any of the underlying code — I simply modified a dummy plugin to do what I needed — leaving the core theme intact.

    *sigh* Needless code geekery.

    The next stage will prove interesting, and I hope I have the coding skills to accomplish it. But that can wait a month or two, I’m in no hurry to write code.

  3. Oh, another thing. Even getting the “Contact” e-mail link into the Navbar took some doing. Again, once I did it, I was impressed with the elegance of being able to do that – I didn’t have to modify any code – but it’s not something that you’d look at and say, “Hey, I can use this to do that.”

    In a way, that’s the thing about WordPress and why I really enjoy using it. It’s like playing with LEGO, and you’re never really sure what you can do, until the day you do it.

  4. what’s the name of the plug-in to use to fix the footer text? I want to add the copyright notice, but i cant figure out how.

Leave a Reply

Your email address will not be published. Required fields are marked *