• Resolved vokabre

    (@vokabre)


    I’m currently rewriting and migrating my website I’ve been running with a different translation plugin for a while and so far I’m very impressed by qTranslate X, it’s very clean and very easy to work with even if my knowledge of inner wordpress magic is very lacking.

    However I found one particular case for which I couldn’t find an easy solution to.
    “Hide untranslated content” feature works pretty well and actually hides all the content in all cases. Yet I still would like for readers to be able to see “sorry, this article is only available in other languages” message on single post in case if the reader have followed a link from the outside or have selected from a menu a language in which the post haven’t been translated.

    So basically I’d like to have an exception for “hide untranslated content” in case if is_single(). Can it be done somehow without deeply digging into the plugin inner workings?

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Clause

    (@johnclause)

    I had impression that it works exactly as you described it. Single pages and posts still show what they have ignoring option “Hide untranslated content”. Is not it working this way?

    Thread Starter vokabre

    (@vokabre)

    Thanks for a quick answer!
    For me it’s not so, I’m getting WordPress 404 response.

    As you replied I thought that it might’ve been because of bad code in the theme, or because of some plugin doing something strange, but I’ve tried with the default twenty-fiveteen-theme and no plugins active besides qtranslatex, and still, I get 404 on untranslated posts.

    I’ve also just noticed that with pages everything works fine, only posts are affected.
    That’s confusing.

    Thread Starter vokabre

    (@vokabre)

    It seems that I managed to fix the case (for now).

    First I’ve noticed that the bug dissapears if %post_id% is added to permalinks.
    I’ve tried the plugin with a different and older WordPress installation and got the same result with 404 on posts, so then I re-checked .htaccess files and webserver configs, but nothing came up.

    Then I dug into the plugin’s code and eventually fixed the problem by removing this piece from qtranslate_frontend.php (I’m ignoring a few commented lines for the quote).

    `if($single_post_query){
    $single_post_query = preg_match(‘/ID\s*=\s*[\'”]*(\d+)[\'”]*/i’,$where,$matches)==1;
    }`

    Honestly, I don’t quite understand what happened, but everything seems to be working fine now.

    I had the same issue with the latest qTranslate X version. Commenting the lines suggested by vokabre fixed it.

    This should be fixed, or made a setting, in the next version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hide untranslated content in all cases except for a single post’ is closed to new replies.