On Writing More WordPress Code

Two months ago, I wrote how I was planning a blog redesign.

It’s not something I’ve worked on with any great alacrity; I don’t need it for another eight months. Basically, a nearly decade-old blog has outgrown its host, and I need to move it to another host, but my current hosting plan isn’t up until the middle of June. So, here and there, I’ll work on a little code, and last night I spent three hours working on the front page. What I have in mind is a magazine-style theme, and while my current site is sort of that, I want to take it a little further and better integrate the elements.

There are some things I’ve never used in a WordPress theme that I’m experimenting with.

Javascript. I built a featured posts carousel using Javascript. It required two custom loops to pass information to the JS routine properly, and to my ever-loving shock it worked correctly the first time.

Post Thumbnails. My present theme uses post thumbnails, but it doesn’t use the built-in WordPress functions to generate or display them. The current theme does. I’ve defined what the default size should be, and then I’ve also defined three other sizes, based on what role a post has on the front page. Plus, one of those sizes is used to put an image on the single post page automatically. Things I would hard-code into a post I don’t have to hard-code anymore.

Custom Loops. I’ve used modified loops before — my present theme uses a modified loop to completely hide the Twitter archive posts for virtually every view — but not to this degree. I’ve discovered how to create a loop that pulls posts by category names instead of the reference number, and then how to create a loop that excludes by category names. This creates more coherent, more readable code under the hood.

As a tangent, I’ve also discovered how to pull a page and display it by its page name.

I am not sure if I need Post Types.

Right now, I’m about seventy percent of the way there to where I want to be with this new theme. I need to do some work with widgets, and I need to do some work on the sidebar.php and the functions.php files. Then, I need to create some of the ancillary files, like customized archive pages, tag pages, a 404 page, that kind of thing.

And I need to think about typography, too.

It’s not a priority. Just something that’s fun to play with. 🙂

Published by Allyn

A writer, editor, journalist, sometimes coder, occasional historian, and all-around scholar, Allyn Gibson is the writer for Diamond Comic Distributors' monthly PREVIEWS catalog, used by comic book shops and throughout the comics industry, and the editor for its monthly order forms. In his over ten years in the industry, Allyn has interviewed comics creators and pop culture celebrities, covered conventions, analyzed industry revenue trends, and written copy for comics, toys, and other pop culture merchandise. Allyn is also known for his short fiction (including the Star Trek story "Make-Believe,"the Doctor Who short story "The Spindle of Necessity," and the ReDeus story "The Ginger Kid"). Allyn has been blogging regularly with WordPress since 2004.

Leave a Reply

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