Archive for December 2nd, 2008

WordPress Theme: Inove

December 2nd, 2008

As mentioned in my previous post, I upgraded wordpress and am using the Inove theme. I chose it because it looks clean and has basic functionality (most wordpress themes do not). When I say clean, I mean I like the use of black, white, and grey colors, I like the fonts, I like having posts be black on white with the background of the page being grey (anything but white, helps focus attention to the posts). I also like the simple search box in the header, I like the small simple icons like green dots for lists, calendar icon, categories icon, tags icon, comments icon, etc. I like how how tables are done, pre format is done, and a few other things.  However, it is not perfect for me.  So …

Things I changed included

  1. Fixing bug where tag icon appears even if a post has no tag
  2. Moving categories and tags to the top of posts – I prefer having all the meta information in one place.
  3. Moving RSS code from top of sidebar.php to bottom
  4. Removing non-widget code from sidebar.php – If a widget is not chosen for N, S, E, W, defaults are shown like archives and categories.  I don’t want 2 categories, as esserd said. If I want something, I will use widgets.
  5. Tweaked styles.css to add padding to bottom of lists (.post .content ul,   .post .content ol)
  6. Changed header on search results and archive (tags, categories) from 2 lines to 1 line.

Overall great theme.  Thanks mg12!!!  Also, check inove forum for other issues.
UPDATE: You can find my changes in inove-1.0.5.diff.tgz, preview the readme or diff.

WordPress Update

December 2nd, 2008

Geek Warning…

I’ve been wanting to update chadnorwood.com for a while, so over the weekend I upgraded wordpress from version 2.3.x to 2.6.3 and picked out a new theme.  First I did a wordpress export of my blog as a backup.  Then the upgrade was done using hostmonster’s fantastico deluxe, an automated installing system in cpanel.  Some don’t like fantastico, but it took me 10 seconds to do the upgrade with no problems.  Success.

After the upgrade it took me almost 4 hours to figure out why my category links were broken.  WTF? Basically under 2.3 I had my permalinks setup so if the URL was http://chadnorwood.com/tag/travel/ wordpress would show posts under the tech category.  So I upgrade to 2.6, and Settings-Permalinks show “tag” as the “Category Base” but /tag/travel is broken – no longer works in 2.6.  Of course I didn’t think about changing this till I examined the mysql database tables, dug through thousands of lines of terrible wordpress code, and googled every phrase combination related to this I could think of.  In the end, I reverted back to the basics and it all worked.  I still had to resolve the 404 issue of the old tag links, which I did using template_redirect.

Picking the theme took even longer – but that was more fun.  I basically viewed about 50 of the most popular wordpress themes, downloaded and installed 10 of them, activating one at a time and testing them for functionality and style.  Only 4 seem to have all the basic functionality working correctly, and even tho I liked the wood in State of Mind, I went with the Inove theme. Inove is more clean and shayna thought the wood one was too academic.  I also tweaked Inove .. but thats in the next post.

Overall the wordpress 2.6 is not much different.  The admin pages look cleaner and are better organized for the most part, but the db has changed and some stuff is broken so I would only recommend upgrading if there was a specific theme or plugin that needs 2.6.  I really love the plugins and themes – the number of great choices makes wordpress much better than all the other blogging platforms. It’s not perfect, and the documentation could improve alot, but these wordpress guys are still actively working on making a better blogging software which is a very good thing.

WordPress: template_redirect

December 2nd, 2008

Before I upgraded to wordpress 2.6, I had URLs using tags like this:
http://chadnorwood.com/tag/travel/

After I upgraded I realized I liked categories better (they can have parent categories).  So no more tags, all categories, but the problem was that google (and others) still link to /tag/travel/ which ended on a 404 page. Since I had no tags, I decided to redirect all my  /tag/xxxx to /cat/xxxx – I also prefer /cat/xxx to /category/xxx, which I changed in Settings-Permalinks.  Here’s how I did the redirect exactly:

Add the following to the end of ../wp-content/themes/<current_theme>/functions.php file

// added at the end of functions.php file, in my current theme's directory
add_action ('template_redirect', 'check_for_tag_404');

// custom function to redirect old tag links to new cat links
function check_for_tag_404()
{
$pat = '/^\/tag\/(.*)$/';

// return if this URL does not begin with "/tag/"
if (!preg_match( $pat, $_SERVER["REQUEST_URI"])) return;

$uri = $_SERVER["REQUEST_URI"];
$uri = preg_replace( $pat, '/cat/$1', $uri);
$location = "http://" . $_SERVER["HTTP_HOST"] .  $uri;
header("Location: $location");
exit;
}

Big Ups to this template_redirect dude for giving me a clue.