Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ HELP with W3C Validator

Posted by: temeter Feb 7 2019, 10:15 AM

Hello.

A friend of mine have a website and we want to check it and validating for errors (WCAG 2.0 AA). So, when I check it in https://validator.w3.org I got some errors like above:

ERROR1: ------------Element head is missing a required instance of child element title.----------

From line 1, column 736; to line 1, column 742

d/atom/"/></head><

Content model for element head:
If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a title element and no more than one is a base element.
Otherwise: One or more elements of metadata content, of which exactly one is a title element and no more than one is a base element.



ERROR2: ------------link element between head and body.-------------

From line 1, column 743; to line 1, column 914

"/></head><link type="text/css" media="all" href="https://www.yourphysiopath.gr/wp-content/cache/autoptimize/css/autoptimize_365c6b81cd9cf8d3a27dc3e25a4b9a5e.css" rel="stylesheet" /><link


ERROR3: ------------Cannot recover after last error. Any further errors will be ignored.----------------

From line 1, column 743; to line 1, column 914

"/></head><link type="text/css" media="all" href="https://www.yourphysiopath.gr/wp-content/cache/autoptimize/css/autoptimize_365c6b81cd9cf8d3a27dc3e25a4b9a5e.css" rel="stylesheet" /><link



The website is Wordpress site. I have tried several plugins to fix them and some edit in header.php but I can't find anything else. Where I can find those html codes to fix them? In which wordpress file/s? Can you help please?

Thank you.

Posted by: Christian J Feb 7 2019, 10:44 AM

Hello!

QUOTE(temeter @ Feb 7 2019, 04:15 PM) *

ERROR1: ------------Element head is missing a required instance of child element title.----------

The above sounds like the TITLE element is missing in the HEAD section.

QUOTE
ERROR2: ------------link element between head and body.-------------

LINk elements can only be in the HEAD section (in fact no HTML elements are allowed between HEAD and BODY).

QUOTE
The website is Wordpress site. I have tried several plugins to fix them and some edit in header.php but I can't find anything else. Where I can find those html codes to fix them? In which wordpress file/s?

My guess would be inside header.php. But I'd assume especially TITLE should be easy to edit in Wordpress.


Posted by: temeter Feb 7 2019, 11:15 AM

Hello Christian_J smile.gif

Thank you for your reply.

Yes I have checked header.php code but I'm not sure what else files to check that would have the errors inside them sad.gif

Maybe I will upload the code from the header.php file so we can check it more good.

Sorry for my English.

Thanks.

Posted by: Christian J Feb 7 2019, 01:34 PM

QUOTE(temeter @ Feb 7 2019, 05:15 PM) *

Maybe I will upload the code from the header.php file so we can check it more good.

Please do!

QUOTE
Sorry for my English.

No problem, English is not my native language either.


Posted by: temeter Feb 8 2019, 06:34 AM

Hello.

Ok I understand, thanks smile.gif

So, here is the code from header.php file:

<!DOCTYPE html>
<!--[if IE 7]><html class="ie ie7" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 8]><html class="ie ie8" <?php language_attributes(); ?>><![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!--><html <?php language_attributes(); ?>><!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<meta name="format-detection" content="telephone=no"/>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'rss2_url' ); ?>"/>
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'atom_url' ); ?>"/>
</head>
<?php
if ( is_singular() && pings_open( get_queried_object() ) ) {
?><link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"><?php
}
?>
<?php wp_head(); ?>
<body <?php body_class(); ?>>
<div id="page">
<?php get_template_part( INSPIRY_PARTIALS . '/header/header' ); ?>

Posted by: pandy Feb 8 2019, 10:05 AM

Yeah, Christian was right. There is no TITLE. And here's the misplaced LINK.

CODE
</head>
<?php
if ( is_singular() && pings_open( get_queried_object() ) ) {
?>

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

<?php
}
?>
<?php wp_head(); ?>
<body <?php body_class(); ?>>



Posted by: temeter Feb 8 2019, 11:29 AM

Hello Pandy and thank you for your answer smile.gif

Hmm, so I have to insert Title tag inside head. But the code that is out of the Head tag (this one you sent me) have to be inside the Head tag, right?

Posted by: Christian J Feb 8 2019, 11:30 AM

To get the TITLE element back, you might use something like this (somewhere between the <head> and </head> tags):

CODE
<title><?php wp_title(); ?> - <?php bloginfo( 'name' ); ?></title>

but I'm not sure if this is considered "best Wordpress practices". unsure.gif

Posted by: Christian J Feb 8 2019, 11:32 AM

QUOTE(temeter @ Feb 8 2019, 05:29 PM) *

the code that is out of the Head tag (this one you sent me) have to be inside the Head tag, right?

Yes, I think you should put this before the </head> tag:

CODE
<?php
if ( is_singular() && pings_open( get_queried_object() ) ) {
?>

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

<?php
}
?>
<?php wp_head(); ?>


Posted by: temeter Feb 8 2019, 11:34 AM

Hey Christian smile.gif

Ok I will try it and I will inform about it.

Thank you.

Posted by: temeter Feb 8 2019, 11:52 AM

Ok, I have tried but nothing yet sad.gif

Now with this code it gives me 2 errors and 4 warnings. Before was only 3 errors.

The code now:

<!DOCTYPE html>
<!--[if IE 7]><html class="ie ie7" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 8]><html class="ie ie8" <?php language_attributes(); ?>><![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!--><html <?php language_attributes(); ?>><!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<meta name="format-detection" content="telephone=no"/>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'rss2_url' ); ?>"/>
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'atom_url' ); ?>"/>
<?php
if ( is_singular() && pings_open( get_queried_object() ) ) {
?><link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"><?php
}
?>
<?php wp_head(); ?>
<body <?php body_class(); ?>>
</head>

<div id="page">
<?php get_template_part( INSPIRY_PARTIALS . '/header/header' ); ?>

Christian the Title tag didn't worked smile.gif Maybe something else it is. I can't fully understand it.

Posted by: Christian J Feb 8 2019, 12:09 PM

This part:

CODE
<body <?php body_class(); ?>>

must come after </head>.

QUOTE(temeter @ Feb 8 2019, 05:52 PM) *

Christian the Title tag didn't worked smile.gif Maybe something else it is. I can't fully understand it.

You didn't put it in the code example above. What does the validator say if you use the TITLE code?

Posted by: temeter Feb 8 2019, 12:15 PM

Ok I have done what you said me and now the validator says:

Element title not allowed as child of element head in this context. (Suppressing further errors from this subtree.)

Posted by: temeter Feb 8 2019, 12:19 PM

All these errors comes only from header.php file? Maybe the problem is also in another file, I don't know smile.gif

Posted by: Christian J Feb 8 2019, 01:37 PM

QUOTE(temeter @ Feb 8 2019, 06:15 PM) *

Ok I have done what you said me and now the validator says:

Element title not allowed as child of element head in this context. (Suppressing further errors from this subtree.)

That sounds strange. Can you post a code example of it again please? Also please post the HTML code of the HEAD section (that the validator sees, as opposed to the PHP code).

Posted by: temeter Feb 9 2019, 01:57 PM

Ok the code now is:


<!DOCTYPE html>
<!--[if IE 7]><html class="ie ie7" <?php language_attributes(); ?>><![endif]-->
<!--[if IE 8]><html class="ie ie8" <?php language_attributes(); ?>><![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!--><html <?php language_attributes(); ?>><!--<![endif]-->
<head>
<title><?php wp_title(); ?> - <?php bloginfo( 'name' ); ?></title>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<meta name="format-detection" content="telephone=no"/>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'rss2_url' ); ?>"/>
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo( 'name' ); ?>" href="<?php bloginfo( 'atom_url' ); ?>"/>
<?php
if ( is_singular() && pings_open( get_queried_object() ) ) {
?><link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"><?php
}
?>
<?php wp_head(); ?>

</head>
<body <?php body_class(); ?>>
<div id="page">
<?php get_template_part( INSPIRY_PARTIALS . '/header/header' ); ?>

I hope you mean this code smile.gif If not please let me know what code you want to see.

Thank you a lot.

Posted by: Christian J Feb 9 2019, 05:12 PM

Can you also post the HTML code that web browsers see? You can view it by loading the page in a browser and press Ctrl+U (in Windows). Maybe you can also see the full source on the validator page. The HTML for the HEAD section should be enough.

Posted by: pandy Feb 9 2019, 11:42 PM

Or simpler just link to the the page so we can see for ourselves.

The title is in the right place in the template, so this last error is a little odd.

Posted by: Christian J Feb 10 2019, 05:01 AM

Maybe the PHP functions wp_title() or bloginfo( 'name' ) are not supported by this WP configuration, and outputs something invalid. In that case I probably cant't help much, since I don't have WP experience. I suppose you could enter the TITLE text manually, but that defeats the purpose of using WP in the first place.

Posted by: temeter Feb 11 2019, 06:25 AM

Hello my friends smile.gif

Sorry for the delay.

Ok here is the website link: https://www.yourphysiopath.gr

As I saw my self many code in the head section. I don't know what is the problem.

Ok Christian no problem I understand fully and thank you both for your help smile.gif

I'm waiting for your reply smile.gif Thank you a lot.

Posted by: Christian J Feb 11 2019, 11:46 AM

There are two TITLE elements, only one is allowed.

Posted by: pandy Feb 11 2019, 12:28 PM

You have two instances of TITLE. The validator complains about the second and redundant one. Where that one comes from... wacko.gif


CODE

<!DOCTYPE html>

<!--[if IE 7]><html class="ie ie7" lang="el"><![endif]-->
<!--[if IE 8]><html class="ie ie8" lang="el"><![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!--><html lang="el"><!--<![endif]-->

<head>

<link type="text/css" media="all" href="https://www.yourphysiopath.gr/wp-content/cache/autoptimize/css/autoptimize_365c6b81cd9cf8d3a27dc3e25a4b9a5e.css" rel="stylesheet" />
<link type="text/css" media="all" href="https://www.yourphysiopath.gr/wp-content/cache/autoptimize/css/autoptimize_365c6b81cd9cf8d3a27dc3e25a4b9a5e.css" rel="stylesheet" />

<title> - Φυσικοθεραπευτής Τερζόγλου Χαράλαμπος – YourPhysioPath</title>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="profile" href="https://gmpg.org/xfn/11">
<meta name="format-detection" content="telephone=no"/>
<link rel="alternate" type="application/rss+xml" title="Φυσικοθεραπευτής Τερζόγλου Χαράλαμπος – YourPhysioPath" href="https://www.yourphysiopath.gr/feed/"/>
<link rel="alternate" type="application/atom+xml" title="Φυσικοθεραπευτής Τερζόγλου Χαράλαμπος – YourPhysioPath" href="https://www.yourphysiopath.gr/feed/atom/"/>


<title>Φυσικοθεραπευτής Τερζόγλου Χαράλαμπος – YourPhysioPath</title>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Posted by: pandy Feb 11 2019, 12:35 PM

These two errors I don't understand.

CODE

Error: Stray end tag head.

From line 1, column 7240; to line 1, column 7246

[endif]--></head><body


CODE
Error: Start tag body seen but an element of the same type was already open.

From line 1, column 7247; to line 1, column 7441

--></head><body data-rsssl=1 class="home page-template page-template-templates page-template-home page-template-templateshome-php page page-id-11 cookies-not-set inspiry-themes inspiry-medicalpress-theme">


I don't find any reason for those.

Posted by: pandy Feb 11 2019, 12:42 PM

I changed doctype and removed the XHTML slashes so I could validate with our validator. It doesn't complain about those last two errors.

Posted by: pandy Feb 11 2019, 12:53 PM

It's something in the embedded JavaScript that makes the validator think there's something amiss with </head> and <body> .

Posted by: pandy Feb 11 2019, 12:55 PM

Sorry, Christian. I didn't see your reply about the duplicate TITLE. blush.gif

Posted by: Christian J Feb 11 2019, 05:12 PM

QUOTE(pandy @ Feb 11 2019, 06:35 PM) *

These two errors I don't understand.
CODE

Error: Stray end tag head.

From line 1, column 7240; to line 1, column 7246

[endif]--></head><body


CODE
Error: Start tag body seen but an element of the same type was already open.

From line 1, column 7247; to line 1, column 7441

--></head><body data-rsssl=1 class="home page-template page-template-templates page-template-home page-template-templateshome-php page page-id-11 cookies-not-set inspiry-themes inspiry-medicalpress-theme">


I don't find any reason for those.

There's a link and image in the HEAD section, where they 're not allowed (only in BODY):

CODE
<a href="https://kepa-anem.gr/wp-content/uploads/sites/2/2017/11/%CE%B1%CF%86%CE%AF%CF%83%CE%B5%CF%82%CE%BA%CE%B5%CE%B9%CE%BC%CE%B5%CE%BD%CE%BFAkiklosFLprin2018.pdf" target="_blank"><img style="float: right;" src="https://www.yourphysiopath.gr/wp-content/uploads/2018/12/orizontio1.jpg" width=450 height=400 alt="ΕΠΑνΕΚ 2014-2020"></a>

My guess is the above implies that the HEAD section has been ended and BODY has begun (keep in mind the start and end tags for HEAD and BODY are optional). Then when the validator sees the literal </head> and <body> tags it suddenly treats them as duplicates.

Posted by: Christian J Feb 11 2019, 05:14 PM

BTW the server for https://www.yourphysiopath.gr/ responds very slowly.

Posted by: pandy Feb 11 2019, 05:28 PM

Yes, very.

Ah, I didn't see that link. Odd though, when I removed the script blocks the errors went away.

Posted by: Christian J Feb 12 2019, 05:49 AM

I also should add that there are more validator errors showing up, after you fix the first ones. I don't know the quality of today's Wordpress HTML code, maybe some of it is not worth fixing all of it.

Posted by: temeter Feb 13 2019, 06:13 AM

Hello smile.gif

Any news? Did you saw the code of the website?

Thank you.

Posted by: temeter Feb 13 2019, 06:14 AM

Sorry I didn't show the page 2 smile.gif

Posted by: temeter Feb 13 2019, 06:23 AM

Hmm ok I see.

What do you propose to do? Because I do not have the knowledge to solve all these problems. Should I hire someone to make them? If I create an administrator account can any of you solve the problems? With the corresponding payment of course. Otherwise, is there anything I can do for myself to fix these problems?

Posted by: pandy Feb 13 2019, 07:05 AM

If you are going to pay for help it's probably better to get someone who is used to WordPress. And good at web standards. It might be hard to find one that are good at both though.

If the site works as it should, I would just correct what's easily corrected errors and leave the rest. If you find 10 WordPress sites and validate them, I bet you none of them will be without errors and most will have more than your site.

Posted by: pandy Feb 13 2019, 07:27 AM

Found this list by a WP lover of blogs that use WP. I did just a few, but those were full of errors.
https://www.wpexplorer.com/name-brands-use-wordpress/

Check a few of them for errors and I think you'll see what you are up against. There's WP itself, then there are third party templates that may add even more errors and in most cases probably do...

Posted by: temeter Feb 13 2019, 09:37 AM

Ok Pandy I see wink.gif

Yes you are right, I understand fully and I think the same way too.
Ok then, I will think what I can do. If I find a good solution I will let you know.

Thank you a lot both of you for your help. Have a nice day smile.gif

Posted by: pandy Feb 13 2019, 02:40 PM

You too. And good luck. happy.gif

Posted by: temeter Feb 14 2019, 04:10 AM

Thank you smile.gif

Posted by: temeter Feb 28 2019, 09:18 AM

Hello my friends.

Finally the problems (errors) of the website resolved. I hired someone to fix them and everything ok now.

I want to thank you very much for your help here. I hope to be well smile.gif

Have a nice day!

Posted by: pandy Feb 28 2019, 11:59 AM

You are welcome. Sorry we couldn't help more. smile.gif

Posted by: temeter Mar 2 2019, 12:20 PM

No problem. Even what you did and give some help is very important smile.gif

Thanks.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)