• Resolved ekajuan

    (@ekajuan)


    Hi Chouby, nice plugin.
    Not long ago, I change my theme to Avada. I found polylang has a conflict with this theme.

    My settings:
    Default language: Bahasa Indonesia
    URL modifications: The language is set from content
    Hide URL language information for default language
    Remove /language/ in pretty permalinks
    Activate languages and translations for media

    Permalinks:
    https://dapur-uang.com/sample-post/

    Basically, if polylang is activated it interfere with the setting saving of Avada theme options.

    After a further investigation I found that Avada stores its theme options’ settings on wp_options table – avada_options
    But if your plugin is activated, it makes avada saves all the settings in avada_options_id

    _id I think that’s the code for my language Indonesia.

    Meanwhile to render the theme always use the settings stored in avada_options.

    So what should I do to fix this?

    https://www.ads-software.com/plugins/polylang/

Viewing 15 replies - 16 through 30 (of 31 total)
  • Thread Starter ekajuan

    (@ekajuan)

    O.. it works now. Yippy!

    At all, the steps:
    Assuming you have set the language you want to use in Settings > languages > languages tab.
    And using this plugin: https://downloads.www.ads-software.com/plugin/polylang.zip

    1. Click: Settings > languages > Setting tab
    2. Look at the URL modifications
    change from:
    The language is set from content
    to:
    The language is set from the directory name in pretty permalinks
    3. Save changes
    4. For each language you use, set the theme options.
    Look at the top bar: Show All Languages. Choose the language before setting the theme options.

    Thanks a lot Chouby.

    O yea, will it influence the SEO since my blog post url has extra /id/ or /en/, for example:
    previous
    dapur-uang.com/just-an-example
    now
    dapur-uang.com/id/just-an-example

    Thread Starter ekajuan

    (@ekajuan)

    Ups…one little problem. With polylang the Avada search on the frontend becomes unusable. It throws 404 page or just return to the homepage.

    Anyone experiences the same thing?

    Thread Starter ekajuan

    (@ekajuan)

    Ah..let me be more specific with the search problem.
    I use a custom page as my front page. The url is like this:
    https://dapur-uang.com/id/beranda

    If I do search the url becomes like this:
    https://dapur-uang.com/id/beranda/?=the+search
    This throws error

    But if I don’t use any page as front page or if I just use the latest post as my front page, the search works normal. The url is like this:
    https://dapur-uang.com/id/?=the-search

    Is there any solution?

    The issue seems to be solved now, thanks.

    The search works fine on my website, the languages are set from the directory name.

    From what I understand, every language has its own options that are independent from those of the other languages, so modifying something when the topbar shows “All languages” is useless, but I asked confirmation in the Avada forums.

    I’m using Avada 3.7 with Polylang 1.6.1.5.

    Plugin Author Chouby

    (@chouby)

    @ekajuan
    Don’t bother about SEO, dapur-uang.com/just-an-example will be automatically redirected to dapur-uang.com/id/just-an-example by Polylang. So all your external posts and pages links will still work.

    Your issue with the search may come from the fact that the theme does not pass the search form through the get_search_form. You can work around this by checking the Polylang option: The front page url contains the language code instead of the page name or page id

    @dominman
    Please follow the steps as written by @ekajuan. It should work now.

    As we are 3 to have tested the fix succesfully, I mark the topic as resolved.

    Plugin Author Chouby

    (@chouby)

    Hi all,

    I reopen this topic as I discovered several bugs in the function causing the conflict with Avada. So I wrote a new fix. Hopefully this one is the right one. But I would be very glad if some of you could test this new development version 1.6.1.6 before I release v1.6.2 in a couple of days.
    https://downloads.www.ads-software.com/plugin/polylang.zip

    Before making the test, I advise that you make a backup of your current development version as there is no easy way to download old development versions (only v1.6.1.6 is currently easily accessible).

    As I said in my last post, I asked the Avada developers how the options are supposed to work when multiple languages are active in Polylang. Their answer (https://goo.gl/8GkVPw) was basically what I expected:

    If you make changes on the “All languages” theme options panel ALL theme options will be written to ALL languages, so you will end up with all options being the same on all 3 langs. So if you only want to change one specific opion, yu will have to do it on per language basis.

    So, to keep the example I used in the Avada forums: when I’m in the Avada options panel and I change the number of footer columns when in Show all languages, the columns should change in all the active languages, but from what I tested, it only changes for the main language that is set in the Polylang settings, every other language is not affected by the change (I tested this with every cache plugin and also the browser cache deactivated, of course).

    I don’t know if this is an issue to be fixed on the Polylang or the Avada side, but it’s definitely something to check.

    (using Polylang v1.6.1.6)

    Plugin Author Chouby

    (@chouby)

    Hi

    From what I can understand from the Avada code in admin/index.php, what you observe is the right comportment: “All languages” and “Default language” modify the options of the default language only.

    Could you confirm that you can correctly define on set of options per language on admin side and that this set of options is correctly applied on frontend?

    I’m not sure I get what you are asking for, could you elaborate?

    When I make some changes in the Avada options and I save them, I see the changes on the frontend, that works fine, but only for the default language set in the Polylang preferences. But, according to what the devs say, if I have 2 or more enabled languages and I change something when in All languages, that change should be saved in all the languages in one shot, instead of manually change that thing 2 or more times. This is what is not working.

    Another example I just tried now: I have English and Italian as activated languages in Polylang. The default language in the Polylang settings is Italian. If I’m in the All languages page of the Avada options and I change the site width from 940px to 1000px, for instance, I expect the width in the frontend to be changed in both the Italian and the English version of the website (that’s because I’m modifying the All languages options, right?), but instead the site width is modified in the Italian site only, and I guess that’s because Italian is my default language in Polylang. When I change the default language to English and try to do the same, the width only changes for English but not for Italian, and again this is not the expected behaviour if I have understood correctly what the Avada developers said it should be.

    So my point is, the Avada options for the single languages work and they are saved just fine. It is the All languages page that is not saved site-wide and does not overwrite the options for all the single languages.

    Just for reference, I tried to replicate what I did before in Polylang with WPML and it works as expected: every change done when in All languages is automatically saved in every single language, overwriting those options.

    Plugin Author Chouby

    (@chouby)

    I proposed a fix to the Avada developer for this problem.

    My initial question was: are you able now to set different options for your different languages (not using All languages as admin filter)?

    Yeah, as I said, that is working now.

    Hi,

    I just want to share my temporary fix.

    Here’s my Polylang (version 1.6.4) options
    – 2 lang (“en” set as default + “fr”);
    – Language determine by directory;
    – Default language is not hidden.

    Here’s what I observed
    – Editing Avada options in “All languages” update “Avada_options”;
    – Editing Avada options in “English” update “Avada_options”;
    – Editing Avada options in “French” update “Avada_options_fr”;
    – Accessing a french page for the first time create the option “Avada_options_fr” by making a copy of the option “Avada_options”.

    These code snippets can be injected in the “functions.php” of your theme or in your plugin.

    This one will assure that the “Avada_options” is load every time:

    // If trying to get the localized options...
    add_filter('option_Avada_options_fr', function($value) {
    	// Return the good ones.
    	return get_option('Avada_options');
    });

    These one will assure that you can update the theme options even if your not in the default or “All languages” polylang settings:

    // If trying to create localized options...
    add_action('add_option_Avada_options_fr', function($option, $value) {
    	// Delete the localized options just created.
    	delete_option('Avada_options_fr');
    	// Add/update the good ones.
    	update_option('Avada_options', $value);
    }, 10, 2);
    
    // If trying to update localized options...
    add_filter('pre_update_option_Avada_options_fr', function($value, $old_value) {
    	// Update the good ones.
    	update_option('Avada_options', $value);
    	// Return the same value for cancelling the update.
    	return $old_value;
    }, 10, 2);

    I believe this is the best way to approach this:

    /**
     * Disable Unique Theme Options Per Language
     */
    function _avada_disable_lang_options() {
    
    	if ( is_child_theme() ) {
    		$temp_obj = wp_get_theme();
    		$theme_obj = wp_get_theme( $temp_obj->get('Template') );
    	} else {
    		$theme_obj = wp_get_theme();
    	}
    
    	$theme_name = $theme_obj->get('Name');
    
    	define( 'OPTIONS', $theme_name . '_options' );
    	define( 'BACKUPS', $theme_name . '_backups' );
    }
    add_action( 'init', '_avada_disable_lang_options' );

    I’m using this successfully in a child theme without issues. A note to the folks at Avada: if I wanted a unique website for every translation I would create a unique website for every language.

    Kevin Leary is it work with Avada 3.8 ?- if yes please tell me how to do it – I am not a programmer ? THX

Viewing 15 replies - 16 through 30 (of 31 total)
  • The topic ‘Polylang Conflicts with Avada Theme’ is closed to new replies.