Hi Kvvv,
I had had the same question before.
If I understand your question correctly, probably the answer is the following:
<html <?php language_attributes(); ?>>
Insert the above on your header.php
The language is automatically switched.
It passes the HTML5 Validation as well.
Thread Starter
kvvv
(@kvvv)
Hi createpop
Tried it but didn’t work. The result on the screen http://prntscr.com/u7ay5c
Hi,
I guess you are missing the end tag “>” at the last.
I hope you can fix it.
Thread Starter
kvvv
(@kvvv)
When editing the code, there are two closing brackets, but one is not displayed on the site
http://prntscr.com/u7b0q7
The code is correct. When I check my header.php I see this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta ...
If I check the page source then the language is replaced by the current language set (nl-BE):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl-BE">
<head>
<meta ...
rgds, Wilfried
Thread Starter
kvvv
(@kvvv)
When I check I see this:
<html <?php language_attributes(); ?>>
But if I check the page source I see:
<html <?php language_attributes(); ?>
But my tag <html> located in _layout.twig
It looks that the function is not called. Can you try to switch debug on in wp-config.php?
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_DISPLAY’, false);
define(‘WP_DEBUG_LOG’, true);
Or mayby it does not return the correct language. Is the language you switched to correctly installed in the Language Management (qTranslate Configuration)?
rgds, Wilfried
Thread Starter
kvvv
(@kvvv)
I think correctly. When switching the language, the language code is added to the url. <Linl> hreflang works correctly