She's Geeky – Tour of WordPress template code

There were 20 or so people at this talk, including non-programmers and programmers wondering if they should install WordPress, and bloggers and admins already familiar with WordPress. We did a round of introductions:

* Graphic designer interested in what degree of control she could have over a WordPress blog.
* Benay, running a blog connecting seniors with caregivers.
* Collie, looking for help with a WordPress upgrade on a complicated blog. Where is community to find help or pay someone to help? (Collie and others: you might try Heather L. Sanders. Anyone else have recommendations?)
* Person who installed WP to force herself to learn more code. Curious about plugins. Which are most useful?
* Terri – uses WP at her job for blogging, thinking about running her own for personal use.
* Nadine – Installed WP for other people many times. Does a lot of troubleshooting.
* Laura – Has installed and messed with WP many times. Wants to create a template from scratch.
* Stephanie – has an HTML site. Might want a blog.
* Olya – is a blogger. sometimes has language barrier while troubleshooting.
* Estella – artist, craisin.com.
* Crystal Marie – adding a blog to her existing web site. Looking at WP and Drupal.
* Beth C – Loves WP. Would like to do more customization.
* Michelle – Is a coder
* Vee – Blogs for her company. Knows HTML.
* Min – Uses MoveableType, is curious
* Karen M. – Thinks there might be entrepenurial opportunities with WP
* StephanieBamBam – Personal blog

I’ve been using WordPress for several years and administer a group blog. As part of my job, I do tech support for bloggers who run into template problems and quite a few of them use WordPress, so I look at a lot of different templates and help people troubleshoot. (The other part of my job, I munge data, write back end tools and infrastructure-y scripts in Perl, Python, and PHP in an aspiring codemonkey way.)

I started out by saying that WordPress was blogging software that you can either use on wordpress.com, or can download for free and install on your own server or web host. You will need an account somewhere and need to have it clear in your mind that you’ve got a username and password for that server account. In that account you’ll be making a folder where you install WP, and then you’ll have an administrative username and password for the WP admin and blogging interface. You may need to pay attention to this in order to change file permissions and make your theme files writeable if you want to edit them from the Theme Editor web interface. This tends to confuse people who aren’t used to web hosting. Also, some people use web hosts which have one-click installs or who install WP for you and then charge to upgrade or maintain it.

We looked at the files and folders in a WP installation. There was some discussion of how you move files around and edit them. (Either from the command line on your server, from the admin interface for theme files, or with FTP; you can download the WP files, and extra themes and modules, to your computer, then upload them to your web host.) It’s a good idea to just look through all the folders, so you know what’s there. You may want to read through the wp-config file. But most of what people deal with is in wp-content, in the themes and plugins folders.

We then looked at the WP administrative dashboard, a bit at Widgets, and then at the Appearance menu and the Theme Editor. I said that editing code in the Theme Editor window sucks. While it’s great for making quick changes, I recommend you edit the files in a text editor that will color code the code and indent it nicely, like vim or Textmate. You can pass code back and forth with other people by putting it into pastebin.com, which will also color code and indent it nicely. Also, it’s amazingly helpful to print out all the template code, and mark it up with pen, and see which bits you can understand; or at least understand more or less what it does.

I explained briefly that anything that looks like a command with parentheses after it, like get_header, is a function and you may need to look for it in functions.php to figure out what’s happening. We looked at index.php for a little bit. It is helpful to read through it. You should be able to mark what is header, what is the content (including “The Loop” which will cycle through your posts), and what’s the footer.

The WordPress codex is your friend. Here’s some great starting points:

* http://codex.wordpress.org/Using_Themes
* http://codex.wordpress.org/Stepping_Into_Templates
* http://codex.wordpress.org/The_Loop

Take a look at your sidebar.php file, header.php, footer.php, and page.php for individual post pages.

At some point, I mentioned the site to look for and download WordPress Themes. You can specify whether you want fixed width or floating; one, two, or three columns; and other parameters such as the main color. It is often best to start with a fairly popular theme.

Keep track of customizations you make to the theme you pick, because at some point you will want to upgrade or change it. Make backups.

There was some discussion of plugins as well. All in One SEO Pack (which sounds a bit evil, but which is great since it makes your URLs a bit more human readable as well as search-engine-friendly) had good recommendations. Stats, Sitemaps, and various Flickr or photo plugins were mentioned by bloggers at the session. On the group blog I co-administer, we had written some code to pull in a list of all our plugins onto a static page called “What we use”, which has come in handy many times when we want to recommend useful plugins to other people. (Whoops; when I tried to show this off, I found that our recent upgrade to 2.7 had broken this code.)

The post template plugin was mentioned for its usefulness and for being able to pick a post or a page and “template-icize” it. This sounded intriguing!

Someone else mentioned that people should be aware that new plugins might break other ones and if you run into trouble, uninstall some plugins and see if that fixes the problem.

Someone else asked if there are good books for learning WordPress theme development or php. I don’t know about books, but php.net is fantastic, and the WP Codex is quite good. The Codex is also editable by its users, so if you use it a lot, make an account, log in, and fix any documentation that’s wrong when you figure out a solution. I also recommended blogging your template or code problems or posting on forums, and then posting the solutions to those problems when you figure them out. This is hard to do sometimes, but the more of us who do it, the better.

When I mention IRC at this conference my general impression is that people aren’t using it that actively and many people don’t know what it is. People who were techy or coding at all or playing on MUDs or smoething before the web, or before about 1995 or 96, know what IRC is. People who learned their stuff or got involved with online worlds after that, it’s much more hit & miss. In any case, I continue recommending people try IRC and hang out in channels on freenode that have to do with the tools or languages they’re using. Here’s some explanation & guidance on IRC and WordPress. Lurk for a while, pick up the culture of the channel, and you might be surprised you can actually answer other people’s questions: when I do this I tend to feel better about asking questions myself.

At some other point I mentioned MAMP again. It’s very handy and easy to install, if you want to run a local web server off your Mac in order to develop and test.
While I was doing this hour long talk, at least two people downloaded and installed MAMP and WordPress and got it running on their laptops.

I enjoyed this session! We didn’t go all that deep, but we covered a lot of ground and people seemed energized by the ideas and possibilities. If you were there, thanks for coming, and let me know how your project turns out!

She's Geeky

2 thoughts on “She's Geeky – Tour of WordPress template code

Leave a Reply

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