qTranslate integration with WP3.x Nav Menu

The whole topic is year old, and there are few good solutions posted on this thread at Qian Qin’s Support forum.

I posted this one, which is altered Woo Themes workaround for the same problem with Home link, modified using qTranslate getLanguage() function.

This is a template. Make a page called anyhow on this custom template basis, than link to it in WP menu. Use URL you need in template, it will redirect language accordingly.
Now you can link to your Home page from WP Menu and it will be correctly translated.

Debug WordPress latency after database import or upgrade

I was really stuck recently, when client websites started to show unbearable 5-11s latency after importing to their new home WordPress installations. It took time to debug and it let me learn a trick or two on mysql performance optimisation. This is something I’d like to share.

Firstly, do not run into mysqld variables shuffle and editing. Check the source of the latency. It may arise for quite different reasons. And definitely – do not alter ‘localhost’ in your wp-config.php to your hosting IP address, that won’t work anymore. What I recommend – make some changes in wp-config.php and the footer of your theme to enable MySQL query debugging.

Add

1
define('SAVEQUERIES', true);

instruction to wp-config.php to enable debugging mysql queries. To output them, add

1
2
3
4
5
6
7
8
<?php
if (current_user_can('administrator')){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}
?>

to your theme’s footer. It will make output visible while you are logged in as administrator.  Now you can sum up all the time from your queries and check if too many or too long queries are the reason of your website latency. Now you have strategy. Either cache bad long queries, make database optimisation, reindex what is needed, or increase memory allowance to PHP or WordPress itself.

If you are running MultiSite, it is always good to explicitly define the memory limit available for WordPress by adding

1
define('WP_MEMORY_LIMIT', '64M');

to your wp-config.php.

Such problem can arise when you have large image galleries to show, when you run MultiSite with new sites imported from older installations, or when you have caching disabled in MySQL.

Suggested reading for further enlightenment:

What to edit in wp-config.php

How to optimise MySQL performance

If your site generates way too many queries to database, i.e. more than 1000 per GET, you should check your wp-options table and .htaccess rules. The root of all evils (up to WP version 3.2.1 is to keep permalinks structure like /%category%/%postname%/. Start it with /%year%/ and your website latency may become immediately cured.

WP Minify is blessing

I had to go through 21 plugin with a map and chisel on one of my employer’s projects recently. Most of them shared similar scripts, many added unused CSS. After inspection I realised, that all this mess could be shortened. But doing this manually would consume an exorbitant amount of time. Instead, I searched WP plugin database for an automated solution. And I have found it. It is called WP Minify. It does the tedious job of sorting your JS and CSS files, combining them, and compressing all together. In just one sitting you can improve your page loading time three times.

To make plugin working you shall need to allow server to write to plugin cache folder and to change its configuration files. This can be done with chown and chgrp commands. If you do not have access to them, ask your hosting provider to change permissions for these files respectively.

Hello world! Boring tasks of system administration are close to completion.

After midphase.com dumped my old hosting plan without notice, I started to think, is it really that complicated to run a small hosting yourself? After all, Linux OS is very well documented and you just need to read and listen, and do good. Oh, I learnt very well how not to do unnecessary, the cost of “interesting” could be huge on a personal scale in terms of wasted time. Thus, limited myself to very basics with no X-related fun, I have started to run this at rackspace. Just because ping is better to rackspace in London than to gandi in Paris.

What was bad, I am in the middle of a project for my current employer, so I only got few evenings to everything set up. What was good,  I have got around 30 of such evenings to have fun with a new server setup.

Rackspace lacks CentOS 5.6 docs in its knowledge base and is really making business on tech support, keeping its predefined system images just bare bones. It took time for me to realise that their repos does not install PHP 5.3 by default, so if you mistakenly did

# yum install php

than you have to yum remove it, instead doing

# yum install php53

Since by default CentOS 5.6 still includes PHP 5.1 in default software distribution.
Fortunately, MySQL was not an administration problem.

Here I am. Happy birthday!

Which WP plugin to use for multi-lingual site?

WPML or qTranslate? Of course, qTranslate. It is easier to follow and well documented plugin, has a very healthy community around it, and you can fork your favourite plugins to work with it.

Cost
qTranslate: Free
WPML: $79

User base
qTranslate: 2656 members, 535 ratings at WP.org, 290 000 downloads.
WPML: 70 showcases, 17768 posts on users’ forum. Download number not disclosed. Members number not disclosed.

qTranslate sitemap: 65236 downloads
WPML sitemap: 3386 downloads

I believe, that qTranslate community is healthier.

Visited expo, found the plugin

Yesterday I visited expo. I looked for solutions for my e-mail marketing and event management mess, I am struggling around all the time with permanent success. And I have found some.
Nice guys from elliottyoung were very kind to introduce me to their WP-based event management solution. They spent kinda 6 man-months of development time on it. I was not really much impressed of the admin panel design, but their set does the job, and for the 2000 quid site license can be a bargain for a one-man show events producers and corporate hospitality fans. Heck, it will even work for a larger business.
Of course, you can set up your own framework using BuddyPress and Events Manager for it, write custom post types for your Speakers and Exhibitors, and go on. It will be a pleasant and fruitful exercise, but it will not save you the precious time. So if you are in management business – have a look on elliottyoung’s job. They even have an app for every feature-rich smartphone to use with your events management wordpress-based website.

WP Editing workflow upgraded

I just found the EditFlow. For those who manages a serious content-rich blog it is indispensable tool. A must have for Editor with Administrator rights. Allows you to organise less technically savvy Writers and customise their workflow in a way beneficial for speed, organisation and control of your content.

I will check how Editflow works with Custom Post Types and update. One of my projects will flourish from such functionality add-on.

Pull images from RSS feed to WordPress

This is a plan. Use existing plugins to pull images from RSS feed to WP and display them in a widget gallery. After doing a bit of search and read, I discovered the following information sources up for the task.
1) Solves the problem of creating RSS feed with images or their thumbnails from WP. Credits go to Justin Tadlock. He created a plugin for outputting basically anything to customized RSS feed from WordPress.
2) Solves the problem of displaying gallery in a widget using customised or pre-defined jQuery effects. Credits go to Mei Chuah for the excellent functionality of the Super WordPress Gallery Plugin.
3) The question is how to feed the gallery plugin from customised RSS?

Hm… maybe use the HungryFEED and parse mRSS?