Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to find a way to selectively disable qTranslate - I would like to be able to show certain static content on my site in 4 languages, but to then only have a single language (and a simplified editor) for posts and also custom post types.

I would also need to disable the output on selective pages in the front-end, so that I can show all the language content on the same page, at the same time.

Is there a way to have the plugin load on demand?

share|improve this question
1  
This is a user support, Plugin-specific question that would be better-directed to the qTranslate Plugin support forum. –  Chip Bennett Feb 10 '12 at 20:08
    
thanks chip - I did also post a question there, just hoping to find a good solution and so asking in a few places where those answers might come from... –  Q Studio Feb 14 '12 at 19:20
add comment

2 Answers 2

up vote 1 down vote accepted

Following snippet will disable it for post_type post (modify array below to affect other post_types):

function qtrans_disable()
{
    global $typenow, $pagenow;

    if (in_array($typenow, array('post')) && // post_types where qTranslate should be disabled
        in_array($pagenow, array('post-new.php', 'post.php'))) 
    {
        remove_action('admin_head', 'qtrans_adminHeader');
        remove_filter('admin_footer', 'qtrans_modifyExcerpt');
        remove_filter('the_editor', 'qtrans_modifyRichEditor');
    }
}
add_action('current_screen', 'qtrans_disable');

Similarly you can disable it for specific post IDs. However take into account that this won't affect already existing multi-languaged content. Therefore use it before you enter any.

share|improve this answer
    
Be careful with this if enabling the "Hide posts not available on the current language" option in qTranslate: it will effectively hide any new posts from these post types where you disable the qTranslate editor in archives, search results and other listings. You'll need to filter out the posts_where clause to remove the LIKE "%<!--:en-->%" check that qTranslate adds to all queries for these post types. –  guidod Dec 5 '13 at 18:27
add comment

There is an answer in the qtranslate forum that seems to address this. It involves changing the core files of the plugin, though. Any luck with it?

share|improve this answer
    
thanks for the link - I did also post my question on the qtranslate forum, but stackexchange is far more active.. would be great to be able to avoid changes to core code, such as making an addition to functions.php - do you think that could be possible? –  Q Studio Feb 11 '12 at 11:40
    
I did a quick search, and I don't seem to be able to find a hook where to do this in current versions of qtranslate... It would be a good addition, though, and I could see uses for it myself as well, so I would be very interested in hearing how you will get around it! :-) –  englebip Feb 11 '12 at 22:13
    
the solution in the qtranslate forum seems to be to disable the back-end - I simply need to disable the plugin in the front-end now.. any other ideas? –  Q Studio Feb 15 '12 at 20:35
    
What do you mean disable the plugin in the front-end? Not show the language-change switch when you're displaying the custom post type? You could do that by using a conditional tag perhaps? –  englebip Feb 17 '12 at 13:31
    
I will have some static pages in 4 languages - thanks to qtranslate - then I want posts and other CPT's only in a single language - I'll use a front-end editor to allow users to add these - however, they do not always display correctly due to qtranslate taking over the display of the content on all post types. –  Q Studio Feb 18 '12 at 18:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.