Adding Version to CSS Files

blog — Tags: , , — anon @ 10/03 1:52 pm

Okay, this is something I have seen before, but it were never attracting my interest so far. But after reading Vladimir Prelovacs short note about adding a version to CSS files using PHP, I clearly understood why this little trick can be so useful when updating CSS files. Dunno why this didn’t come into consideration before.

Basically if you often do any changes to your CSS the old version of the file will normally be served to your visitors as the cache expiration header is set to a far future time.

To remedy this a parameter needs to be added to the CSS file URL that will make it distinct every time you change it. Best way to do it is by using the timestamp of the file.

<style type="text/css" media="screen">
   @import url(<?php echo bloginfo('stylesheet_url'). '?' .
filemtime(get_stylesheet_directory() . '/style.css'); ?>);
</style>

For example here is how my CSS URL looks like:

<style type="text/css" media="screen">
   @import url(http://blog.datenkompost.de/wp-content/themes/barecity_1.5/
style.css?1266235697);
</style>

Quick Chess Board released

blog — Tags: , , , — anon @ 10/03 11:50 pm

This plugin for Wordpress allows you to display a chess diagram in your posts or pages.
It uses a replication of the Wikipedia template ‘Chess diagram small’ and a very basic syntax to insert such a board into a post or page.

Quick Chess Board uses small fragments of Viper007Bond’s Templatedia plugin.

(more…)

How to Customize the Wordpress Tag Cloud

blog — Tags: , , , — anon @ 09/01 4:02 pm

If you’re like me you might also want to change the default settings that the Wordpress Tag Cloud use. Normally this would be done in the sidebar.php that lives inside your theme folder, but in my case – I use the Widget Editor – I don’t have any control over the Tag Cloud. So I decided to hack the Wordpress core no matter what others are saying about that. Of course, I have to mention that changes getting reverted after you update.

For this you need to modify the wp_tag_cloud function in the category-template.php file. It’s remarkably easy to do. Here’s how.

  1. Open the file /wp-includes/category-template.php
  2. Search for the line that begins with function wp_tag_cloud
  3. Make changes in the array as follows:
    • To specify the smallest font size, set the value after ’smallest’. The default is 8 points
    • To specify the largest font size, set the value after ‘largest’. The default size is 22 points
    • To specify the maximum number of tags included in the cloud, set the value after ‘number’. The default number of tags is 45
  4. Overwrite the existing file with the changed file

Easy, huh? This is considered as a hack. So don’t blame me if something happens to your Wordpress install or if suddenly everything blows up completely.

Google Code Prettify

blog — Tags: , , , — anon @ 08/12 10:28 am

Recently I stumbled across this little Javascript that prettily colors your embedded code after loading the page. While searching for it I also came up with a Wordpress Plugin by Dean Lee.

Like Dean already mentioned in his Blog: “It’s hard to say which is better, choose one based on your own needs.”

copyright © 2008-2010 datenkompost.de/blog - barecity derivative | imprint
* a title remix inspired by a popular german book