Feed Icon RSS 1.0 XML Feed available

Wordpress Kubrick Customizations from 2007

Date: 7-Nov-2007/19:11


Characters: (none)

UPDATE 1-Jan-2014

This is an article about historic technical details related to installing my site with Wordpress 2.5, which I installed in November 2007. The "LAMP" stack was something I knew I probably would not enjoy dealing with. Little did I know that the experience would be so annoying that WordPress would wind up leaving my occasional writings trapped for over six years in a system with a fixed-width theme that could barely display code samples worth a darn.

Between then and when I actually learned something about web development, I made entire websites for other individuals, bands, projects. Somehow the tedium of figuring out how to get the data out of an old WordPress just seemed like an exercise not worth bothering with. Especially since I wasn't all that convinced other solutions were better.

But for the 2013 holidays and my New Years resolution, I bit the bullet to get my data out and build a new site. I'm sure WordPress has improved, but what I'm looking for in a publishing system needs to have more of a "programming" flavor. (I know many developers who have switched to [Jekyll](http://jekyllrb.com/) and GitHub pages, precisely because having developer-style control with reigned-in complexity outweighs large monolithic systems that seem to have every feature in them but the ones you actually want!)

So the following remains as a time capsule of the frustrations I had to work through just to get the basic WordPress installed, which left me convinced I needed something better...

I've had to do various customizations to Wordpress in order to make it a viable content management system. Some of these relate to theming and plug ins, but there are also some outright bugs. Here are the changes I made from the default installation, and hopefully they can be useful for anyone else who is going through the motions of dealing with WordPress quirks.

Visual Changes

The theme I use is Kubrick which is the default.

UPDATE 27-Jan-2014

Kubrick has been moved to "retired" status, I've updated the link

Here were the changes I made for visual customization, and I tried to keep it minimal.

  • Replacement of the wp-content / themes / default / images / kubrickheader.jpg default image with one of my own devising. One also needs to go into the presentation options under "Header Image and Color"...click advanced...and toggle the text display off.


    If you've tweaked the colors for the header you have to use the "Revert" button to get it back to using your header jpeg instead of a gradient.

    Another thing that's a good idea is to pick a background color for the header region that doesn't look too horrible while your header image is being downloaded. Otherwise you'll see a flash of a color that doesn't fit your theme while the page is loading. You make this change in two places in wp-content / themes / default / style.css, replacing the hex value #73a0c5 in the header style with whatever color you think is most appropriate. I don't know why this number appears more than once, but presumably they have their reasons:

    #header {
            background: #73a0c5 url('images/kubrickheader.jpg') no-repeat bottom center;
    #header {
            background-color: #73a0c5;
            margin: 0 0 0 1px;
            padding: 0;
            height: 200px;
            width: 758px;
  • Increase of the font size of body text in wp-content / themes / default / style.css from 62.5% to 10px. Without this change, fixed width fonts were unreadable on my machine:

    font-size: 10px; /* Resets 1em to 10px */
  • Add the following styles for pre-formatted text to wp-content / themes / default / style.css, as used in code samples:

    code {
      color: #090;
      font-size: 9px;
      font-family: Monaco, "Courier New", Courier, monospace;
    pre {
      overflow: scroll;
      margin: 0;
      padding: 0;
      font: 11px lucida console, courier new;

    The narrow columns of the Kubrick theme does not C:\handle\file\paths\which\are\long\very\gracefully and the justification gets ruined very quickly. (Notice how screwed up the first line of this section is if you are using Firefox 2 or other older browsers?) This is disruptive since I like to talk about the precise paths I'm working with. So I added the following style to wp-content / themes / default / style.css

    /* to use, do:
    <span class="filepath">
    c: / directory / subdir / file.txt
    </span> */
    .filepath {
        font-family: 'Courier New', Courier, Fixed;
        border: 0px
        font-weight: bold;
        background-color: LightGoldenRodYellow;
  • When naming the style.css</span> file to add these lines to, all I had to do was type:

    <span class="filepath">wp-content / themes / default / style.css</span>
  • Change the text in wp-content / themes / default / footer.php from "Hostile Fork is proudly powered by WordPress", where WordPress is a link to http://wordpress.org. I made it say "Hostile Fork grudgingly admits to running his site with WordPress", where WordPress is a link to WordPress on Wikipedia.

    While I'm glad the software is free and has a large community of people working with it, I don't necessarily think it's the best option out there (even given what little I know at this point)--and it's certainly not best for everyone. So I think it's best to link to a better vetted overview which will lead people to understand their options in content management systems.

  • By default, article pages do not have the sidebar, which is silly in my opinion as you already have to make the article look good in a narrow column for the main page...so you might as well have the sidebar there to give readers additional information about the site. To put the sidebar on single article view, change the part in wp-content / themes / default / single.php so it says:

    <div id="content" class="narrowcolumn">

    Then at the end of the file, before the line that says <?php get_header(); ?>>, add the line:

    <?php get_sidebar(); ?>
  • WordPress gives your web pages ugly titles, with noise words like "Blog Archive"... rather than just the title of your articles. It's bad for search engine optimization, so you should change your wp-content / themes / default / header.php so that instead of saying:

    <title><?php bloginfo('name'); ?> < ?php if ( is_single() ) { ?> ยป Blog Archive < ?php } ?> <?php wp_title(); ?></title>

    it says:

    <title>< ?php if (is_home () ) { bloginfo('name'); echo ' - '; bloginfo('description'); }
    elseif ( is_category() ) { single_cat_title(); echo ' - ' ; bloginfo('name'); }
    elseif (is_single() ) { single_post_title();}
    elseif (is_page() ) { single_post_title();}
    else { wp_title(); } ?></title>

Manual Bugfixes

The next set of problems I had to fix were related to bugs in WordPress, of which these all apply to the current version (2.3.1). For whatever reason, they haven't been fixed in the default installation:

  • When you write a "page" (such as this one about Site Technical Details) Wordpress is theoretically able to handle people leaving comments and discussion, just like on blog posts. Yet the default theme ignores the checkbox saying you want to allow comments on pages, and though some people seem to disagree that this is a bug, I assure you that it is! To work around this you have to edit your wp-content / themes / default / page.php, and add the following line right before the end of the

    whose id is "content":

    <?php comments_template(); ?>
  • If you write "pages" in wordpress, the way you get them in an ordering is to give them a priority number. Initially all pages get a priority ("Page Order") of 0, and in theory pages at the same priority level are sorted alphabetically. For whatever reason, it doesn't work this way and Page Order gets completely ignored. You need to modify wp-content / themes / default / sidebar.php on line 46 so it says:

    <?php wp_list_pages('sort_column=menu_order&title_li=<h2>Pages</h2>' ); ?>

    Furthermore, if you have done any "widgets" settings in your wordpress it will completely override sidebar.php, and thus won't even use the modification above! So you have to click the options button for the "Pages" widget in that case and make sure it is sorting by page order.

  • The XHTML that WordPress generates is invalid when you try to put multiple categories of links on your sidebar. (By default you have just one category, "Blogroll", but I wanted to use more.) The simple fix is to edit your wp-includes / widgets.php file to have this line of code inside the function wp_widget_links(), right before the call to wp_list_bookmarks():

    $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);


I had heard a lot about WordPress's plugin architecture. After looking at it, I'm not so sure I'd call it an architecture, it's really just some haphazard hooks. You find that there are ordering problems and cases where plug-ins do not work together because they both try to override the same hook, or are run in the wrong order. Plug ins modify the source of Wordpress when they install in ways that are irreversible. Despite this insanity, you can at least see what's going on... so I don't feel so bad about installing this set:

  • The wp-cache plug in. This is generally considered a necessity. Without it, each time Wordpress is asked for a page it will generate all the HTML using a long sequence of PHP scripts, hitting the mysql database many times.

    UPDATE 27-Jan-2014

    The wp-cache link had gone dead, and perhaps the current incarnation would be WP Super Cache? Don't know, don't care. :-)

    I had an unusual situation where wp-cache would not work at first, and it turned out to be due to the fact that I'd added the line:

    define('WP_CACHE', true);

    to the end of the wp-config.php..after the line that said:


    The instructions said to add the line manually to the file, but it didn't say where. So I incorrectly assumed that the end of the file was as good a place as any. Looking further showed that's not true, because there is code that wp-cache adds to wp-settings.php that depends on the flag. From reading the web I see a lot of cases where I suspect others are making the same mistake.


    If you're going to do any site configuration, such as of your styles or things like that... you'll be best to disable the cache plugin while you're doing so and then turn it back on when you're finished. Otherwise a lot of your changes won't seem to have an effect, because the cache doesn't notice such modifications. It only notices when you edit content through the site admin interface.

  • The very cool Link Indication plug in takes care of a lot of nice things... like automatically making external links open in new windows (rather than navigate people off the site where they forget to come back). It also puts a lot of cute icons next to links, so you can see when they are zip files or go to wikipedia... a must-have!

    Installing this plug in is a little more complicated than most. You have to install the plug-in and you also need to unpack the icons.zip file into a subdirectory of wp-content / themes / default / (he suggests the images/ directory, but I made a separate directory called link-indicator/ to keep from polluting the images directory). Also, you have to pick one of the numbered images for external links, his CSS mentions a nonexistent filename. I just went with the first, so my wp-content / themes / default / style.css says:

    /* For Link Indication plugin */
    a.liexternal { padding-right: 12px; background: url(link-indication/link-icon_external_01.gif) no-repeat right; }
    a.liwikipedia { padding-right: 14px; background: url(link-indication/link-icon_wikipedia.gif) no-repeat right; }
    a.liimdb { padding-right: 18px; background: url(link-indication/link-icon_imdb.png) no-repeat right; }   
    a.liftp { padding-right: 13px; background: url(link-indication/link-icon_ftp.png) no-repeat right; }
    a.limailto { padding-right: 18px; background: url(link-indication/link-icon_mail.png) no-repeat right; }
    a.lipdf { padding-right: 12px; background: url(link-indication/link-icon_pdf.png) no-repeat right;  }
  • this one for Google Analytics, which allows me to get some information on how many visits the site is getting. The statistics are only updated once every 24 hours. I haven't looked into the code to decide if this is a good plugin or not, but it does at least not track your own hits when you're logged in--and that's good because I probably visit my site more often than anyone else does!

    I wasn't getting a whole lot of traffic, but due to some of my pages being submitted to StumbleUpon.com I am getting a fairly large influx, however people do not tend to comment or explore the site. I'm having to upgrade my bandwidth since I host several 2MB videos, and 500 views a day * 2MB per view goes to 1GB very quickly. I don't mind--I'm happy to have the traffic--but I do wish more people would comment! I know I didn't get the articles perfect, so at the very least I'd expect some criticism of my spelling or grammar. :)

    Here is a sample Google Analytics Graph snapshot, the number on the far right is 846 views:

    Google Analytics for November and Early December

    Thanks to everyone who's stopping by, and please... if you see something you like don't hesitate to give it a thumbs up or a digg if you think the content is worthy. I'm working reasonably hard and I guarantee I'm never going to put up ads (I'd sooner take the site down) so it's a truly altruistic effort.

  • The wp-syntax plugin, which lets me put in syntax-highlighted code samples. You can even tell it to number the lines, starting at a particular number, which is nice when excerpting bits from a file. Kubrick is really too narrow a theme to support a good view of code, but, this is an interesting plugin to use.

    I installed the Creative Commons Licensing Plugin. It doesn't actually do much--I kind of wish it would let you pick different licenses for particular pages. For the moment, I'm just going with a blanket site license which you can read about under the legal issues page.

Turn off the Visual Editing, Now!

Finally, I will mention something I should have said up front--if you're savvy at all about HTML, TURN OFF THE VISUAL EDITING. It will break your pages. Even if you are in the code view and ignoring the Visual Editor, it will do bad things to your XHTML so long as it is turned on at all. This is maddening, because one would think editing in the code view would encourage WP not to mess with it:

  • Click the "Users" menu in the WP admin area to access your profile.

  • Once you are on the "Users" page scroll to the bottom of the page, and uncheck the "Use the visual editor" option.

After this is done, the only thing you have to worry about is that WordPress will still inject BR elements at every line break in the output. So if you are entering delicate XHTML that would be confused by the appearance of a BR, don't hit enter in between lines inside that construct.

There are my tips so far. I will try to keep this updated as I change technologies or make new findings. I would like to thank my hosting provider: Eric Shalov, for his server + administrative support.

Business Card from SXSW
Copyright (c) 2007-2015 hostilefork.com

Project names and graphic designs are All Rights Reserved, unless otherwise noted. Software codebases are governed by licenses included in their distributions. Posts on blog.hostilefork.com are licensed under the Creative Commons BY-NC-SA 4.0 license, and may be excerpted or adapted under the terms of that license for noncommercial purposes.