1. November 2015

Some options to get those translatable strings out of your templates. I will be adding new things, as I discover them 🙂

  1. xgettext-templateHandlebars & Swig
  2. gettext-twig – {% trans “string here” %}
  3. rtwix – Ruby based TWIG translations extractor
  4. twig-po – Extract translation keys from twig templates and move them to PO
  5. Twig-Gettext-Extractor –  tool which extracts translations from twig templates

Enjoy coding …


31. October 2015

Timber / Twig templates are normally not recognized by Poedit. Its just a matter of tweaking the C/C++ extractor within the settings panel.

Add TWIG to the filetypes: *.c;*.cpp;*.h;*.hpp;*.cc;*.C;*.cxx;*.hxx;*.twig

Gettext calls, like {{__(“Points Conversion Rate”, “wplms-extras”)}} in Timber, are being extracted from your templates after that.

Easier than using the gettext extractor 🙂



Enjoy coding …



30. October 2015

I am currently working on a WPLMS enhancement for a customer, that allows to simplify the payout of instructor commissions. The whole system runs on the MyCred Points System and students pay for courses with Points. The problem is how to easily payout the instructor commissions via PayPal.

There is currently no addon for MyCred available that does that magic, so I build one myself.

At the moment the payment process via PayPal is completely manual, due to budget constraints. I am basically generating a custom “Send Money” link that prefills the PayPal email and amount to send.

The interface itself handles the payout sessions, tracks the instructor balance, paid and unpaid points.

Here some images to illustrate the admin dashboard:


This list the instructors and their point balance and allows to start the payment process.


Payout sessions make sure, that only one session can be started per instructor, as the instructor could earn new points during the process. The points converted can be changed, allowing you to payout a fixed amount of points.

Its a 3 step process. Login at PayPal. Open the “Send money” dialog and send money to instructor. Confirm that you manually send the money and than register the payment and payout points in the system.


The session can be cancelled at any point. You can also leave the session open and continue at a later point.


On the frontend I added an interface to the BuddyPress Profile, that allows the instructor to track his payouts and balance.


The whole setup could be updated using PayPal Adaptive Payments, to make the whole process completely automated. Something to consider for the future 🙂 Pretty happy with the manual process so far and it will be a great help for my customer to keep track of the commission payouts.

The whole setup is currently targeted for WPLMS, but can easily be adapted to other setups using the MyCred Points System.

Enjoy coding …




18. June 2015

TWIG allows you to use regular expressions within its templates, this makes it possible to easily check if a post is sticky in Timber for WordPress.


Comparisons in TWIG


This is the template that is called within the loop on the index.twig to show each post.

The post.class holds the full set of classes assigned to a post, which includes the class “sticky”. We do the match magic and you can use that to style your sticky posts differently 😉


“Timber helps you create fully-customized WordPress themes faster with more sustainable code. With Timber, you write your HTML using the Twig Template Engine separate from your PHP files.

This cleans-up your theme code so, for example, your php file can focus on being the data/logic, while your twig file can focus 100% on the HTML and display.”


Twig is a modern template engine for PHP

  • Fast: Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum.
  • Secure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design.
  • Flexible: Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL.

Enjoy coding …