When monkeys write code…

Today I had my first experience with a blogspot theme. A pretty violent experience. The whole thing is a combination of html + xhtml + css + dark matter + space dust. I was able to forget about colouring the code, about beatufying it and all that and ended up modifying it. A normal line of code looks like this:

<b:section class="main" id="main" showaddelement="no"><b:widget id="Blog1" locked="true" title="Blog Posts" type="Blog"></b:widget></b:section>

And it looked like in the image.

Then comes the CSS. The CSS gave me a bit of a headache because the monkey coder used crappy names. Usually when declaring classes/IDs you should name them in such a way, that if someone else wants to edit, they won’t have to use a debugger to see what you wanted to mean by #footer-wrapper, #footer1, #footer_all!! You should also avoid declaring the same ID in two different places with two different types of properties. Just saying! :death:  But if you want to mindfuck the people that will want to edit your theme, then this is a good way to do it.

And to end it all well, it is pretty hard to actually delete… a sidebar, let’s say. That’s because you have something like the above code, but it’s also linked to some other stuff in the theme, so if you delete only a part of the code, the whole thing breaks and you can’t even preview the changes or save the theme.

So, at the end of the day, you don’t really know what to recommend to a friend who wants a blog. Especially if you think of it this way. It all comes down to how much of a perfectionist you are.

P.S.: I know I don’t write code like a guru, but today I gained more confidence in myself!

Update that theme. NOW!

If you like to tinker around with the style of your theme a lot like I do, you will probably like this article. Our aim is to force the new style.css file over the old one the users’ cache has. You can do this the dumb-dumb way, the hard way, or the easy way.

The dumb-dumb way is to ignore this issue and wait until the users’ caches expire. Not a very good idea if you ask me.

The hard way is to set some .htaccess expire headers. You can add rules for the CSS to expire every x hours, days, weeks, etc. but I thought we were trying to force the new CSS file right away 8-O .

This brings us to the easy way: tweaking the header.php file a bit! All you have to do is replace your usual style inclusion with a new one. The magic line is:

<link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_url'). '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" />

After you update your header.php file you should see something like this when you view the source in your browser:

<link rel="stylesheet" type="text/css" href="http://huzze.net/wp-content/themes/huzze/style.css?1286398426" />
Yeah, the funky numbers after the question mark are the secret.

Simple as that. No more waiting, no more F5, no more nothing. Just a simple click on your “home” button and you will see the changes immediately! :-D

Default avatar

I finally decided to change the default avatar here. WordPress offers a few alternatives for those of you who don’t have a gravatar. The options are:

Please leave a comment with the number you prefer. These are randomly generated, so two different people won’t have the same avatar.

So, what’ll be? (choose even if you have a gravatar :) )

Since I began blogging…

… I observed the following:

  1. The vast majority don’t know how to write properly.
  2. A lot offer SEO and blogging tips on wordpress.com or blogger. People also offer tips on how to get easy money over the internet on these services.
  3. Most don’t use the MORE tag when posting videos or any other flash content.
  4. Blogger is used more than wordpress.com although blogger sucks when it comes to design and functionality.
  5. Loads of people use widgets like calendar and categories. As far as I know, these two are considered useless. Also have seen a lot of flash clocks.
  6. Some can’t read. On the first page you have a post stating you are not accepting link exchange requests and someone leaves a comment (in romanian on an english blog :death: ) on your latest post (without any link the the post’s topic) while there’s a nice ‘Contact’ link in your blog.
  7. The easiest way to make a blog is putting miniclip games on your site and naming your site something-containing-the-word-games. This can be done with or without your own domain. In the case a domain is used then it’s double trouble. You just wasted some money.
  8. Most blogs (on blogger and wordpress.com at least) are made in a moment of boredom.
  9. The most common description in About pages is “I am me (and no one else)”.
  10. Some have captcha + moderation + akismet activated on comments.
  11. Right-click protection is so ’95. If I want to steal something from your site, that will not stop me.

Did I miss anything?

WordPress files and database backup

A while ago I was searching for a php script that will automatically backup some important wordpress files (uploads, plugins, themes) and the database, and send them in an attachment to an email. I was unable to find such a script because I was looking in the wrong place! I wanted to create a cron job in cPanel.

Actually, the solution was way simpler than that. There are a couple of plugins that do exactly what I wanted: WordPress Backup and WP-DBmanager.

I set the first one to backup the plugins, the theme and the uploads folder once a week, while the second one makes a backup of the database once every three days. I have also disabled the optimization feature.

So now I just have to delete the backups stored on FTP every once in a while :-D .

wordpress robot

From wprobot.net:

Powerful autoblogging plugin for WordPress weblogs.

Automatically post Youtube Videos, Amazon Products, eBay auctions, Clickbank ads and much more to your blog without lifting a finger.

Lean back and let WP Robot blog for you!

Why the heck would anyone do that to his blog :waitwut: ?

Stop SOPA