Category Archives: WordPress

Programming WordPress

WordPress: Import Blogroll from Sage

Earlier today i exported the list with blogs i read from Sage and tried to import them into WordPress. Although all the entries had been processed but none of them appeared. Apparently you have to rename the xmlUrl attribute to … Continue reading

Posted in WordPress | Leave a comment

Internationalizing strings with variables

Yesterday i wrote that you can use __($string, $domain) and _e($string, $domain) to internationalize a string with WordPress. I forgot to mention that if you use sprintf you can handle strings with variables too. An example: echo sprintf(__(‘There are %d … Continue reading

Posted in WordPress | Leave a comment

Adding support for localization to a WordPress plugin

WordPress uses GNU gettext, as explained in Translating WordPress and Writing a Plugin, for localization. I decided that my plugins should support l10n too. Here is how i realised it: I started with defining the WPLANG constant in my wp-config.php: … Continue reading

Posted in WordPress | Comments Off

Plugin template for WordPress

Today i’ve been cleaning up my code. All my plugins live in a directory %plugin_name% under the wp-content/plugins directory. Here is the code for %plugin_name%/%plugin_name%.php: <?php /* Plugin Name: %plugin_name% Version: %plugin_version% Plugin URI: %plugin_uri% Description: %plugin_description% Author: %plugin_author_name% <%plugin_author_mail%> … Continue reading

Posted in WordPress | Leave a comment

Adding an action when your plugin is activated

The WordPress documentation says that you have to call add_action(‘activate_pluginurl’, ‘somefunction’) to trigger somefunction when your plugin is activated. Unfortunately i couldn’t find with what pluginurl should be replaced. After a bit of experimenting i’ve found that in wp-admin/plugins.php the … Continue reading

Posted in WordPress | Comments Off