Viewing 1 replies (of 1 total)
  • Hello,

    I’m using Qtranslate slug (http://wordpress.org/extend/plugins/qtranslate-slug/) and I’ve got the same problem, this is how I fixed it:

    I noticed that links in the language widget selector were always working right so I decided to simply replace the links in the error message with these ones, using jQuery…

    Edit /wp-content/plugins/qtranslate/qtranslate_core.php (this one is used by the error message) and add an id to the link:

    $language_list = "<a href=\"".qtrans_convertURL('', $language)."\">".$q_config['language_name'][$language]."</a>".$language_list;

    Let’s say erren or erres (err$language) depending on the language:

    $language_list = "<a id="id='err$language'" href=\"".qtrans_convertURL('', $language)."\">".$q_config['language_name'][$language]."</a>".$language_list;

    Now do the same for /wp-content/plugins/qtranslate/qtranslate_core.php (this one is used by the widget) for this line:

    echo "<li$item_class><a href=\"$url\" hreflang=\"$lang\"$link_class>$link_content</a></li>" . PHP_EOL;

    Let’s say widen or wides (wid$lang):

    echo "<li$item_class><a id=\"wid$lang\" href=\"$url\" hreflang=\"$lang\"$link_class>$link_content</a></li>" . PHP_EOL;

    Now go to your theme footer and add the jQuery workaround juste before the </body>, ie for english links:

    <script type="text/javascript">
    jQuery(document).ready(function() {
    
    if (jQuery('a#erren').length) {
    var widen = jQuery("a#widen").attr('href');
    jQuery("a#erren").attr("href", widen);
    }
        });
    </script>

    You can of course improve the script and use dynamic language tags : wid$tag, err$tag

    Hope this helps

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: qTranslate slug with widget] untranslated content link’ is closed to new replies.