WordPress.com Still Messes Up Tags and Categories [en]

It pains me to say it, but much as I love them, they still don’t quite get the difference between tags and categories. Yes, WordPress.com now makes a difference between tags and categories (and have been doing so for quite some time), but they are still missing part of the equation.

  • Categories are big pre-defined drawers to sort your posts in. They’re local.
  • Tags are labels you stick on posts after you have written them. There are tons of them and they’re messy and they’re global.

Logically, links on tags should point to the general WordPress.com tagspace (they do) — and links on categories should point to the local category pages of that particular blog. Only they don’t always.

The “Categories” widget works the way it should. But the rest is a mess. Examples.

  • Look at the Coworking Léman site, which uses the Mistylook theme that I personally love. This article‘s category links to the general WordPress.com tagspace (wrong), whereas this one‘s category links to the local category page (right).
  • The La Muse site, which uses Ocean Mist, makes article categories link to the general tagspace (wrong) but at the bottom of the page, lists categories with the correct links to category pages.

I could find more.

In general, the problem seems to be that article category links are made to link to the tagspace just as tags do. I mean, what’s the point of having a difference between tags and categories (an important one, if you ask me) if you make them behave the same way in the templates? This is a major problem for me. I hope Automattic are listening and will do something about it. (I contacted support but was told, basically, that it was a feature.)

So, please, Automattic: make the links on category names link to local category pages, and the links on tag names take us to the global tagspace.

Thanks!

WPtouch iPhone Plugin Now on CTTS [en]

[fr] Le plugin WPtouch iPhone permet maintenant aux lecteurs de CTTS munis d'un iPhone de voir une mise en page adaptée à leur petit écran. Profitez!

Some time back I noticed that sites on WordPress.com were sporting a fancy iPhone-compatible theme, like this one:

Xavier put me on the scent of the WPtouch iPhone plugin, which I have just installed on CTTS — should make getting your daily (hrmm… almost) dose on your favorite phone a more pleasant experience!

WordPress Mobile Edition is another plugin which lets you customize your mobile theme more finely.

Linking Flickr Images in Thesis' Multimedia Box [en]

[fr] Instructions pour faire en sorte que les photos de la boîte multimédia du thème WordPress Thesis renvoient vers leur page Flickr.

I haven’t had Thesis on my blog for 24 hours that I’m already messing with it. Oh well. So, one thing I’ve done and will explain in some detail is added tons of photos from my Flickr account to the Thesis multimedia box up right, with links to the original Flickr pages.

  1. I have shell access to my server, which makes life so much simpler. Once inside the rotator folder, all I have to do is grab the URL of the middle-sized photograph I want (All sizes > Medium) and wget it. For example: wget http://farm4.static.flickr.com/3252/2725414522_4a9b2887df.jpg
  2. On the Thesis Options page, I insert the Flickr photo page URL in the “alt” field for that photo. It’s pretty easy to deduce it from the filename. For example: 2725414522_4a9b2887df.jpg => http://flickr.com/photos/bunny/2725414522/.
  3. Following these instructions, I replaced one line in the multimedia_box_functions.php file so that the images would actually link to their Flickr page.

Voilà!

Bunny's Print CSS Plugin Upgrade [en]

[fr] Deuxième version de mon plugin pour insérer automatiquement une feuille de style impression dans n'importe quel thème WordPress. Il y a maintenant un panneau d'administration qui permet d'éditer le CSS directement depuis WordPress -- et le CSS en question a été enrichi.

The little print CSS plugin I threw together the other day has had a little upgrade already, and is also now available in the WordPress plugin directory.

First, Kjell Knudsen was kind enough to add to the very basic CSS file I provided with the plugin. It’s now a little richer and should support K2, for example. It’s still open to improvement, so don’t hesitate to link to your propositions in the comments! Maybe at some point I’ll be able to offer more than one stylesheet with the option to choose between them.

Option? Oh yes, option. Because, you see, Print CSS now has an option panel. I’m pretty happy, because it’s my first plugin with an options panel, and I’ve been thinking I should learn how to do that for some time now. The options panel doesn’t do much, however: it simply allows you to edit the print CSS file through the WordPress admin area (if the file permissions are right — chmod 777 or something).

I’d like to extend all my thanks to Yaosan Yeo, who wrote the MyCSS plugin. I heavily lifted the code for the admin panel from it, as it does essentially the same thing: allow the user to edit a CSS file. I’m really loving MyCSS by the way, even if there is a little capitalization glitch in it, because I’m always adding CSS to my themes and it’s a real pain to copy-paste it all over the place each time I switch themes (or from one blog to another).

Off you go now, check out Bunny’s Print CSS in the WordPress plugin repository!

WordPress Sandbox Theme Problems [en]

[fr] Deux problèmes avec Sandbox: les menus déroulants qui se déroulent décalés sur la droite dans IE, et l'absence de feuille de style pour l'impression. Toute aide bienvenue.

As you might have seen, Sandbox is now my theme of choice for WordPress. Diurnal, here on CTTS, is built upon Sandbox, and I’m using it with a client to build a new design from scratch. It’s a nice base to work from, in a CSS Zen Garden way.

However, there are problems. Here are two I’m stuck with on my client site. I posted them to the Sandbox forums, but I thought I’d mention them here in case one of you smart readers had an answer.

  1. No print stylesheet?: does anybody have a print stylesheet handy for use with Sandbox? If I can avoid writing one from scratch…
  2. Broken drop-down menus in IE: I’m far from a drop-down menu specialist, so I’m not sure where to start to fix the IE wonkiness I’ve noticed. The menus in IE do not drop right below the parent menu as shown here, but overlap on the neighbouring menu item on the right.

Thanks for any help or pointers you can bring me.

Ridding WordPress Plugins of Template Tags [en]

[fr] Cet article décrit une méthode permettant de se défaire des "template tags" qu'utilisent certains plugins. Plutôt que de copier le fameux template tag à 3 endroits différents dans son thème (comme c'était le cas auparavant pour Basic Bilingual), il est possible de modifier à peu de frais un plugin pour qu'il injecte automatiquement son contenu dans le blog.

If you’re like me and use a bunch of plugins to liven up your WordPress blog, you’ve probably noticed that adding template tags in your favourite (or favourite-of-the-week) theme files can quickly become a royal pain in the neck.

One of the things I wanted to do with Basic Bilingual, and which I did with the last release, was make the plugin inject the text for the “other excerpt” (the French text you can see at the top of this post) automatically into the templates and feeds.

Once I’d figured out how to do that, I realised I could modify other plugins, too. And I’m going to tell you how you can do it, too. This method should work for any plugin which generates a template tag, as long as you want the content generated by the plugin to go immediately after or before the post content. (I’m still working on advanced rules for cases where you want to make modifications elsewhere in the template.)

Christine‘s Inline Tag Thing put me on the track (thanks!), as it does just that. Here’s the trick:

  1. create a function which concatenates (= “adds”) the plugin output to the content
  2. add an action hook to the plugin to apply that function to “the_content”.

Fear not, I’ll explain all. You don’t need to really know much PHP to do this, as long as you’re comfortable wading through a bit of code and copy-pasting stuff and making a few small modifications.

Let’s take an example: the Similar Posts plugin, which I’m now using to point out posts related to the current one (normally, in a box at the top of the post if you’re on the website, and as a list at the end of the post if you’re reading the feed).

Similar Posts provides a template tag, <?php similar_posts(); ?>, which you can paste in your template where you like the related posts to appear. Personally, I want them to appear on the main blog page, on the individual archive pages, and on the monthly, category, and taggy archive pages. This means I need to paste the tag into at least 3-4 different template files. And if I decide that I want the tag at the top of the post rather than the bottom, or I decide to remove it, there I go again. Not optimal.

So, here’s how I made it “better” (for me):

A. First, I looked at the plugin code to figure out where the template tag function was; in this case, quite easy, it’s the function called similar_posts(), logically. Here are the last two lines of this function, which do the actual data output:

print $result;
if (defined('POC_CACHE')) print $cache_time;

I changed them to:

return $result;
if (defined('POC_CACHE')) return $cache_time;

So that they didn’t print directly (ie, output text), but just return the value of the data we want to insert.

Then, I created the following function:

function sp_embed_similar_posts($content) {
    $content = similar_posts() . $content;
    return $content;
}

This function takes one parameter ($content), and sticks the output of similar_posts() in front of it. Now you see why we needed to change the other function so that it didn’t print. We’re just modifying the value of the $content string. This new function returns the modified value for the content (in our case, imagine it as being the content of your post with the code for the similar posts listing stuck in front.

Now all that is left to do is to tell WordPress to actually use that function at some point (plugins are usually a collection of functions, followed by a series of “hooks” which actually execute the functions at certain chosen moments). Here’s the action we’ll use:

add_action('the_content', 'sp_embed_similar_posts');

Try it!

This will also add the list of similar posts to the feed.

So, in summary, here is what we have done:

  • modified the template tag function so that it returns a value instead of printing it (in some plugins, you’ll find a function that already does that!)
  • created a function to stick that value on the beginning or end of a parameter, $content
  • add an action hook on the_content to execute the function.

Happy hacking!