Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @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.

    @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;
    	}

    @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, 1 month ago by nightcoder.
Viewing 3 replies - 1 through 3 (of 3 total)