elektroelch.net – blog

WordPress: add_filter or add_action? It actually doesn’t matter!

It’s a doctrine of WordPress plugin development:

Use actions to expand the functionality and filters to change information.

We’ve all heard it, we always follow that demand. Always? Well…

… if I want to add some functionality and nowhere near or far there is an action hook in the core but only a filter hook, I use that hook without considering the doctrine.

Surprisingly it works. But why? If we all insist that you have to use the right hook type, there has to be a difference between them. Let’s take a look behind the scenes (/wp-includes/plugin.php):

What? add_action does nothing but call add_filter and nothing else? There is no difference in functionality, it’s only a different name. So there is no reason why you shouldn’t use add_filter instead of add_action if you have no other solution.

I don’t say that you should interchange filter and action hooks at will. Using the correct hook type makes your code more readable and maintainable, for yourself and for others. Nevertheless, if there’s not other way to accomplish your goal but to use a filter hook instead of an action, don’t hesitate, it virtually makes no difference.

Firefox Add-On version hack: Cutomize titlebar

If I want to tweet a link of a site currently opened in my Firefox/Waterfox browser I using the “Hootlet” from “Hootsuite”. This little Add-On simply takes the text  of the titlebar of the browser and adds an ow.ly link so I can tweet it with a single click.

Unfortunately Firefox adds “Firefox” to the titlebar which I have to delete manually every time. But hey, computers are for automationing things so this should be automated, too. The Add-On repository contains an Add-Ons called “Customize Titlebar” which would do exact the requested task but it hasn’t been updated 2009 and is compatible with Firefox 3.9 (!).

In many cases those Add-Ons still work with current versions of Firefox the only problem is that they are marked incompatible. It’s always worth a try to simply increase the entry and check if it still works. Especially Add-Ons that are not critical like “Customize titlebar”. In this case this little hack actually works and I’m happy to be able to use the plugin.

I set the compatibility information of the Add-On to “50.*” so it should work for some while.

 

WordPress: New Version 0.5 of LinkList plugin

For a long time there was no update of my Linklist plugin because it simply worked, no need for a change. The other day I got a request to expand the functionality and I agreed to the proposal.

Version 0.5 now contains the option to include/exclude individual posts or pages from displaying the linklist:

linklist-addnew

The plugin still assumes that you want to add the linklist ater each post or page because that’s why you installed the plugin after all. Nevertheless you can disable the list by de-selecting the provided checkbox.

If you want to change the display for an existing post/page you not need to go to the posts edit page but can easily do it using the Quick edit feature:

linklist-quickedit

I decided to use a drop down menu instead of a check box because WordPress renders the edit screen in a wilful manner and it can’t be manipulated (Can it? Drop me a mail!).

To change the display of the linklist for a large amount of posts/pages you do not need to edit every single post/page individually but can use the Bulk Edit feature:

linklist-bulkedit-1

(If you don’t know how to use Quick or Bulk Edit you can learn it on wordpress.tv.)

You can update your installation by using WordPress’ own update feature or by downloading it from the repository.




WordPress – You’ve got updates!

On March, 11th an update of the popular plugin “WordPress SEO” was published because the previous version contains serious security vulnerabilities (CSRF and blind SQL injection).
During the day some people noted that Yoast didn’t use all possible channels to call attention to the situation.

I personally couldn’t understand the problem because I already had installed the new version before noon. How could this be? Continue reading WordPress – You’ve got updates!

Job advert in flickr HTML code

The other day I ways looking into the HTML code of the flickr site and found this:

I think this is a really cute idea because if you decide to look at the code you probably have some understanding od the stuff…

New version of Linklist (v0.4) WordPress plugin

A user of my WordPress plugin Linklist wanted to use it in conjunction with a Like/Unlike plugin.

Unfortunately Linklist also listed the like/unlike links of the plugin and put the list behind the Like icon:

linklist1

This is not the way it’s supposed to be. So I added two more options:

  1. You can define several class names of DIVs that will be excluded from being searched by Linklist. This option will also deal with incomplete DIVs (<div> without any closing div).
  2. You can set the priority of the plugin. This will enable Linklist to collect the links and add the list in the post before other plugins are adding their own content to the post.

In the above example the result will look like this:

linklist2

… and yes, Linklist is compatible with WordPress 3.8.

Minor update to pagebar plugin (v2.65)

The last update to the pagebar plugin has been made over a year ago. Since all new ideas will be included in version 3 and the plugin was working fine with every new update of WordPress there was no need for an update.

The other day Borisa Djuraskovic of “Webhosting Hub” wrote me an email that he has created a Serbian language file. This was a good opportunity to introduce a small feature that was spinning in my head for some time:
Continue reading Minor update to pagebar plugin (v2.65)

It’s a real Casio!

IMG_2153-1Watches do have a a common problem: the good one’s are quite expensive and you don’t want to scratch them during daily handicrafts. The cheap one’s are kaputt after such a short time that buying them isn’t worth it.

This week a big German chain store offered a Casio F91-W for 9,99€. I couldn’t say no to this offer. This type of watch exists since 1991 and that cannot be a coincidence. If the watch is operable for on year I am happy but I hope that it will last longer. Let’s see what happens…

Show your desktop

I know loads of WordPress developers by name and have an idea how they look. What I also find interesting is the way people work. Do they use a laptop, how many monitors do they use and other stuf). Here’s my desktop (I’ve tidied it up before taking the image :-)):

desktop.small.1

The machine is an “ASRock Z77 Extreme” with an i5 3,4 GHz processor, 8 GB of RAM and a Radeon HD7770 graphics card.
I’ve got two 24″ Benq monitors and yes, that’s a TV on the left side. The keyboard is a good old “Windows Natural Pro” and the mouse an IntelliMouse.

Ramon Fincken (@ramonfincken) kidded me that I have only two monitors and sent me a picture of his setup:

ramonafincken-small

What a desktop! To cite him “if it’s worth doing .. it’s worth overdoing”.

(Update: Ramon tweeted his PC spces: 16GB RAM, AMD FX 8350 8core, 2x 256MB dual output asus video cards)

What does your desktop look like? Take a picture and blog about it!