Ian Lai
  • About
  • Contact

WordPress: Connecting to an External / Secondary Database

· 2 min. read

$wpdb can only access and manipulate the WordPress database. How may I do the same for another database with different credentials?

WordPress provides developers with a class of functions to manipulate the database and this is particularly useful for custom plugins and/or themes. Developers may interface - create, read, write and/or delete data - with the WordPress database via the global $wpdb object; however, to interact with another database (an external/secondary one) a new instantiation of the wpdb class is required. In WordPress' codex, hyperdb is recommended as the solution "for extremely complicated setups with many databases". If however, you are not too keen on using someone else's plugin it is pretty simple to create your own custom database object using the wpdb class.

Continue Reading »

Google Chrome: Minimum font-size Issue

· 4 min. read

Update (24/05/2014): I have recently discovered that Chromium (Desktop) has dropped support for the text-size-adjust CSS property name rendering the original solution below invalid. The alternative solution is still functional. It is not a bug as far as I am concerned. It is related to the user's Chromium preferences, and it is not advisable to override them.

Why does my website's font-size appear larger on other screens? Or why does it not appear as intended?

A minimum font-size of 12px is set for Chrome users with a special, foreign UI locale (language) - e.g. Chinese, Korean, Japanese, Thai etc. If however, the font-size for any content on your website is set to a value that is less than 12px, it will automatically be resized to 12px. WebKit - the web browser engine behind Chrome which handles the parsing and layout of websites - however, does support font-sizes of 12px and under. Indeed, for most UI locales, Chrome has set the minimum font-size to 1px (simply: anything smaller will be resized to 1px). The way Chrome behaves when dealing with special UI locales may become problematic for web designs relying heavily on magic numbers or typography. Indeed, other users and developers seem to be raising similar concerns about this behaviour and its adverse impact:

← Newer posts