WP qtranslate custom posts + categories and descriptions + plugin

Just created a plugin that has products and categories for wordpress that needed to be translated. Beacuse of the nice hooks in qtranslate I decided to use it. This is who I fixed it:

In my plugin file I added these lines:

add_filter(‘YOUR-TAXANOMY-NAME,’qtrans_convertURL’);
add_action(YOUR-TAXANOMY-NAME_add_form’, ‘qtrans_modifyTermFormFor’);
add_action(‘YOUR-TAXANOMY-NAME_edit_form’, ‘qtrans_modifyTermFormFor’);
add_filter(‘YOUR-TAXANOMY-NAME’, ‘qtrans_useTermLib’);

That worked great for allmost everything, but it did not solve the translation for the category description. To solve that I needed to wrap the output (in my custom template file) with the following function:

echo _e($term->description, ‘qtranslate’);

Oh, and if you want your break rows back, wrap the description with nl2br:

echo _e(nl2br($term->description), ‘qtranslate’);

 

Comment the post if you need help to get it working =)

 

Annonser

Kommentera

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s