Author: Latz

  • Advent Calendar – Predefined callback functions for filters

    Advent Calendar – Predefined callback functions for filters

    Filters are often used for removing content. For example, if you want to hide the admin bar you can do the following: function hide_admin_bar() { return FALSE; } add_filter( ‘show_admin_bar’ , ‘hide_admin_bar’ ); It’s a bit tedious to define an additional function just to return “FALSE“. Since version 3.0 WordPress provides various functions to shorten…

  • Force Reload of Scripts and Stylesheets in your Plugin or Theme

    If you’re developing a WordPress theme or plugin you may have had the problem that scripts or stylesheets are not reloaded from the source when you refresh the page because they are cached somewhere on the way from the server to the browser. There are various methods to suppress this behaviour like disabling the browser…

  • Disable password fields for non-admins

    Disable password fields for non-admins

    So you’ve created a user and added a strong password because you care for your blog’s security? Unfortunately you can’t be sure that the user will keep this strong password since he/she can change it to a much weaker one on his profile page. This problem can be solved by adding a filter:

  • What’s the difference between __(), _e(), _x(), and _ex()?

    If you’re a thorough plugin developer you’re internationalizing (i18n) all your strings. WordPress includes several functions that allow the programmer to easily make his plugin usable natively worldwide: __() _e() _x() _ex() _n() In some older plugins you may find the function _c() which is deprecated and replaced by _x() since version 2.9. If you’re…

  • Adding Input Fields To Comment Form

    Adding Input Fields To Comment Form

    Most comment forms contain the same input fields: Name, Email, URL and the comment text field. This is sufficient for most use cases but there are situations where you might want to know a bit more about your commenter: their age, the city they live in, or the color of their underwear. This article explains…

  • Comment Form Hooks Visualized

    Most themes (e.g. TwentyTen) use the comment_form() function to insert the comment form after posts. There are quite some hooks inside the function but they are hard to localize. The codex documentation isn’t too helpful, neither. To give you an easy overview the following diagrams visualize the points where the various hooks are anchored. The…