Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, thanks for the reply,

    I have been actually looking inside Polylang code in case I could find an obvious place where that change is done, but I had no success. I am pretty new to PHP and WordPress, so nothing strange about that, I may have been looking at the relevant code without noticing.

    I then noticed that wordpress wp_get-archives() function uses get_archives_link() to create the link and that a filter hook of the same name could be used to modify the url, so looked for usage info, tried that and seemed to work.

    Here goes a rather hackish but apparently working code for this particular case,

    
    // Archives widget still points to ../index.php/$lang/.. link. Remove $lang.
    add_filter( 'get_archives_link', 'amd_remove_lang_archives_link');
    function amd_remove_lang_archives_link ($html){
        // Just in case, don't run on admin side
        if ( !is_admin() && function_exists('pll_current_language') ) {
            $curlang = pll_current_language();
            $html = str_replace( '/index.php/'. $curlang . '/', '/index.php/', $html );
        }
        return $html;
    }
    

    I also noticed a couple of additional issues, adding info about them in case someone finds a workaround.

    One minor issue that I find still pending is the recent comments widget, which does not show posts comments when used together with a translated page.

    Another issue that I’d expect hard to address is the similar behavior of the search widget. When used together with a translated widget will only look in the translated language, although all posts are in the default language.

    Regards,

    Thanks a lot for the code,

    I find an still pending issue, when using the archives widget from a page in the second language (en) I am sent to a link that still has the $lang part

    index.php/en/2016/10/

    thus failing.

    Language is set from content, URL language is removed for default language and and “language” string is removed from pretty permalinks. Default language is Spanish, second language is English

    For the records, I am working around the problem of content falling below the sidebar by re-adding below lines to child theme style.css

    .content-wrap {
    float: right;
    width: 79.78723404255319%; /* 750 / 940 = 0.79787234042553 */
    }
    #content {
    float: left;
    width: 62.66666666666667%; /* 470 / 750 = 0.6266666666666667 */
    margin: 0 0 30px 0;
    }
    .page-template-fullwidth .content-wrap { width: 100%; }

    Last line seems not needed. They were changed in 0.5.4->0.5.8 upgrade and, although not needed for parent theme, seem to still help for a child theme.

Viewing 3 replies - 1 through 3 (of 3 total)