Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    This is a conflict with your theme or another plugin which asks Polylang to translate something which is not a string (an array according to the error message). The current development version available on Github removes the warning. But it will of course not fix your theme or plugin which is doing something wrong.

    @chouby it may not a theme / plugin issue. @devsit probably switched from WPML plugin. I got the same error and it turned out that it is the theme_mods array of the customizer that (probably) stored by WPML. FYI.

    • This reply was modified 8 years, 5 months ago by nightcoder.

    @chouby Also, please remember that WPML now allows only single key name to register all theme mods. It means no need to add theme mods one by one.

        <admin-texts>
            <key name="theme_mods_themename">
            </key>
        </admin-texts>  

    In your code, you should also check if there is no sub key, if the it is a “theme_mods_***” then add all theme mods available.

    Something like this;

    	protected function translate_strings_recursive( $values, $key ) {
    		$children = $key->children();
    		if ( count( $children ) ) {
    			foreach ( $children as $child ) {
    				$attributes = $child->attributes();
    				$name = (string) $attributes['name'];
    				if ( isset( $values[ $name ] ) ) {
    					$values[ $name ] = $this->translate_strings_recursive( $values[ $name ], $child );
    				}
    			}
    		} else {
    
    //$values = pll__( $values );
    if(is_array($values)){
     $mods = get_theme_mods("themename");
      foreach{
        //regiter
       }
    }
    
    		}
    		return $values;
    	}
    Plugin Author Chouby

    (@chouby)

    @nightcoder

    Have you some documentation explaining that WPML allows to register theme_mods without sub-options? By default, WordPress uses this option to store things such as nav menus theme locations which must not be translated.

    @chouby I’m not sure if WPML officially supports that but the moment you don’t have sub-keys in the XML, it register all the theme_mods available for the theme.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Warning: md5() expects parameter 1 to be string’ is closed to new replies.