wp_enqueue_style, versioning and conditional CSS comments

Tagged WordPress

I like to enqueue my CSS styles because it has the benefit of adding a version string. A link like style.css?ver=0.7 is useful because it will force visitors to download an updated style.css when the version number is increased. Here’s what I currently use in my functions.php: (more…)

WordPress is stupid

Tagged WordPress

In case you haven’t been aware of this, WordPress core developers think that potentially breaking thousands of links on thousands of sites is an accepatable edge case. Here’s a great summary of what has been said. (more…)

How to add support for navigation menus to your WordPress theme

Tagged WordPress

The new navigation menus system in WordPress 3.0 looks promising, but in my opinion it’s not very usable yet. Anyway, here’s one way to add navigation menus to your theme while maintaining backward compatibility:

In your theme’s functions.php add something like the following code: (more…)

Nesting WordPress loops

Tagged WordPress

Sometimes it’s useful to put a WordPress loop inside another loop. To do this you’ll have to create a new WP_Query object, as in this example: (more…)

Get WordPress comments outside of WordPress

Tagged WordPress

Sometimes you want to access WordPress content outside of WordPress. There are various pages that explain how to this and it’s really easy to do as well. What I tried to do was a little different though, I wanted to print comments outside of WordPress.

To my surprise wp_list_comments() didn’t output anything inside my custom loop. It turned out that $wp_query->comments was NULL, which I think is rather odd. I would have expected it to be defined like in a normal loop inside WordPress. However, the fix is trivial:
(more…)

Using git for WordPress development

Tagged git

git is a powerful revision control system. It is a distributed system. This means that you can commit, create branches or tags on your local hard drive without any network connection. Read more about git on the project’s website, there’s also great documentation there. (more…)

Shortcodes, include CSS and JS only on the correct blog pages

Tagged WordPress

Not too long ago I wanted to add a new plugin to my blog. During various tests I noticed something quite shocking: at least one of the plugins insisted on loading it’s CSS and jquery on every page of my blog. A little more testing showed me that many plugins do the same. (more…)

Creating a valid WordPress theme

Tagged WordPress Deutsch

Recently, I’ve been checking out some of the blogs that link back to me because they use one of my plugins. And it seems like a lot of them are using buggy, incorrect templates. It looks like many WordPress theme developers don’t read the theme development checklist. (more…)

Git clone, ssh: Could not resolve hostname

Tagged git

Now this was annoying. I tried a git clone ssh://user@my.host:/path/to/repository and it failed with

Initialized empty Git repository in /current/path/repository/.git/
ssh: Could not resolve hostname my.host:: Name or service not known
fatal: The remote end hung up unexpectedly

(more…)

HTML forms and onclick/onfocus

Deutsch

When you use HTML forms it is often desirable to pre-fill some input fields. Your idea could be that you want to give your visitors some clue to what they’re supposed to fill in. (more…)