• Resolved Mad Max

    (@mad_max)


    THE PROBLEM:
    I am using the language plugin qtranslate to create a bilingual site, italian as default language and english as second language. I’ve setted qTranslate to add a locale abbreviation to urls for the second (and eventually all other) language(s):

    https://domain.com/nameofcat for default lang (italian)
    https://domain.com/en/nameofcat for english

    As i’ve installed and enabled the WP No Category Base Plugin, the locale abbreviation has been removed from every url, and now WP shows every page in the default language and I have to switch to english every time.

    THE SOLUTION:
    Creanodesign, on the qTranslate forum, has found the solution to the incompatibility between “WP No Category Base” and “qTranslate”.
    You can read about it there:

    https://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=993&p=5893#p5893

    just find the 2 occurences of this line in no-category-base.php:

    $catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $category_nicename, 'category' );

    and change them to

    if (function_exists('qtrans_convertURL'))
    		$catlink = trailingslashit(qtrans_convertURL(get_option( 'home' ))) . user_trailingslashit( $category_nicename, 'category' );
    	else
    		$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $category_nicename, 'category' );

    Hope it can be useful

    https://www.ads-software.com/extend/plugins/wp-no-category-base/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I only found one instance of the code you mention. The “second” instance of setting catlink is

    $catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' );

    If you replace that with your code, you will break your redirects on old category URLs. You have to edit the code to swap out $category_nicename for $query_vars[‘category_redirect’]

    Thread Starter Mad Max

    (@mad_max)

    yes you are right. But (luckily) I putted this error in this topic only and not in the code I patched on my WP installation ??
    So, for the sake of clarity, here are the right version:

    1st istance:
    FROM

    $catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $category_nicename, 'category' );

    TO

    if (function_exists('qtrans_convertURL'))
    		$catlink = trailingslashit(qtrans_convertURL(get_option( 'home' ))) . user_trailingslashit( $category_nicename, 'category' );
    	else
    		$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $category_nicename, 'category' );

    2nd istance:
    FROM

    $catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' );

    TO

    if (function_exists('qtrans_convertURL'))
    			$catlink = trailingslashit(qtrans_convertURL(get_option( 'home' ))) . user_trailingslashit( $query_vars['category_redirect'], 'category' );
    		else
    			$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' );

    Thanks to erichazann for pointing this out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP No Category Base] compatibility with qTranslate plugin’ is closed to new replies.