The process and challenges of building a virtual competition for the tournament in Brazil

By | Alex, General | No Comments

Over the past months I have been building a virtual competition, for one of my clients, for the tournament 2014 in Brazil.

  1. Full integration and signup to the game through Facebook
  2. Multi-language setup
  3. Choose your own team of players from the 32 competing countries, with countries only represented once in your team.
  4. Update your team until the start of the tournament
  5. During the tournament your team scores according to real data coming in from a sport result data provider. Team scores are calculated by a fixed rule set.
  6. You have 3 substitutes that you can deploy during the tournament to optimize your team or replace players that have been eliminated
  7. You play for a specific country or you can join or create a group to compete against each other with friends.
  8. Team ranking is provided on country and group level.
  9. Social sharing, invites and posting to Facebook

The project had its challenges and I plan to dive into some of those areas in the future, as soon as the tournament is over ;)


Make WordPress Contact Form 7 messages multilingual

By | Development, Javascript, Wordpress | No Comments

The Contact Form 7 for WordPress is a nice simple plugin to build contact forms fast. But when it comes to making it completely multilingual it lacks a bit.

I am currently creating a website with 13 different languages, that would mean to create the same contact form 13 times, not really practical :)

I am translating the form labels on the fly with some javascript magic, but for the messages I had to go a bit deeper.

  1. Open wp-content/plugins/contact-form-7/classes.php
  2. Go to line 800 function message
  3. Change this
    to this
    See how I wrapped the gettext function for the return, that does all the magic.
  4. Next we have to make sure that the messages are being found by localization helpers like Codestyling Localization
  5. In your theme functions.php add a translation for each of the Contact 7 Form messages
  6. The first message in the Contact 7 Form admin says: Your message was sent successfully. Thanks.
  7. Do not change these messages in the Contact 7 Form admin anymore or the setup will break. These updates will have to be repeated with each plugin update, unless the author does something similar.
  8. Happy translating.


WordPress WPML: Custom SELECT to get any translated content by language code

By | Development, PHP, Wordpress | No Comments

WPML for WordPress is a powerful plugin to build a multi-language setup. But it still comes short in some areas, especially when it comes to a custom integration into plugins or when using custom post-types.

Normally this function should return the id of the linked translated content, but has not worked for me in some cases (especially when AJAX is involved).

A simple SELECT helps to get that id yourself :)

Free IP geolocation databases

By | API, Development, Javascript, PHP | No Comments

Sometimes when personalizing or translating interfaces, IP geolocation is required.

Maxmind Geolite Free

Besides their subscription based products Maxmind also provides a free IP Geolocation database set. The set is offered under the Creative Commons Attribution-ShareAlike 3.0 Unported License. The free databases maps IPv4 + IPv6 addresses and is being updated once a month. GeoLite Free Downloadable Databases

IP2Location Lite

Another free set of data is provided by IP2location Lite. It is free for personal or commercial use with attribution required

JSON Date (.NET) to PHP timestamp

By | API, Development, Javascript, PHP | No Comments

The JSON spec allows integers, fractional numbers, strings, arrays, but when it comes to dates things are handled differently. There really is no date format in the JSON spec. Would be nice if every JSON date output would conform to ISO8601 :)

Some of these can easily be converted to a PHP timestamp using strtotime(), others require some more magic.

Here is a way to transform the .NET variant, something that has been haunting me in a current project ;)

Due to the wide usage of JSON as an exchange format, I really hope we will see a spec update in the future :)

WordPress Admin + Plugin Development + Less + Bootstrap = Awesome

By | Design, Development, Wordpress | No Comments


Bootstrap can not be added directly to the admin of a plugin, but you can wrap your plugin in a container and compile the Bootstrap CSS to use it as a wrapper.

I do my compiling using SimpLess

In the past you could do this using SimpLess directly (my-own-bootstrap.less).

This fails with the latest version of Bootstrap. But you can just paste the Bootstrap CSS into the LESS file and compile it that way.

Run it through SimpLess and after that the new CSS can be enqueued in WordPress ! This also works nicely with themes from Bootswatch.