WordPress For Geeks #1 – Editing WordPress Theme Files

Wordpress For Geeks

This series has been a long time coming and has without a doubt been my most requested series of 2012. I have done plenty of intro articles on WordPress but readers keep asking me to go deeper and provide some content for people who are more experienced with WordPress. As usual I listen to my readers because, heck, I’m writing this for you, so I thought I would give it a shot!

Welcome to WordPress for Geeks. Over the next few months I will be running this series every Wednesday on MorganLinton.com. In this first segment I want to take a dive into using the WordPress file editor and some of the files you might want to tweak to customize your WordPress site. First things first, if you’re an intermediate I am going to assume that you know HTML and CSS, if you know a bit of PHP that would help but if not you’ll still be able to figure things out a-okay.

Wordpress File Editor

You can access the raw code for some of the key WordPress files by simply going to “Appearance” and then selecting “Editor”. You theme’s style sheet will most likely be the file that you most frequently update, this is typically done through custom.css but for the brave can be done via the root file, Style.css. Style.css is the core stylesheet for your theme and just about all the little tweak you’d like to make will take place in here.

Wordpress Header PHP

Another file that you might want to tinker with a bit is header.php. This is the file that is used to generate the header of a WordPress site. While many themes will allow you to configure this in detail within their own custom dashboard panel, not all do. Even if they do let you make changes to the header you might not always be able to change all the things you want to change. Header.php is also where you might add tracking code for things like Google Webmaster Tools.

Wordpress Footer

Of course every page has both a header and a footer and Footer.php is another commonly edited file. If the theme you are using doesn’t give you a way to edit the footer, this is the way to do it. In most cases you’ll be editing this to remove things like “Site build Using WordPress” or “Made with WordPress” and replacing it with “Copyright 2012 YourCompany.com”. Footer.php, like Header.php is a file you might be editing to add tracking code for software like Google Analytics or Crazy Egg.

Some other commonly edited files are, Single.php, Sidebar.php, and Page.php. Single.php is the template for a single post displayed on its own. Sidebar.php like the name implies allows you to tweak the sidebar of your WordPress site, and Page.php allows you to change how a single page on your site is display.

One of the most important things to remember is that every theme is different so you’ll want to take the time to understand the file structure of a new theme before diving in and making changes. Also, try to remember not to edit Style.css unless you absolutely have to, otherwise look for custom.css and put your code in there. This is a lot cleaner way to build a site and will save you a ton of time trying to track down some small change you made that broke your blog.

And with that I am happy to say you are now on your way to true WordPress Geekdom! Break out your TI-86x and your pocket protector, it only gets geekier from here.

 

{ 1 comment… add one }

  • Thesis 2@Bilal Ahmad August 2, 2012, 11:07 am

    Just to let you know, thesis 2 price has leaked. Chris has confirmed the price for developer license and personal option.

    Reply

Leave a Comment