WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The template I used as a start for my own design places the metadata inside the header tag of the single-post.php. Is that a correct use of header, or should there only be h-tags in there? What about the post image? Could that be part of the header?

share|improve this question
What to you mean with "header"? <header>? Inside of the <header> tag there shouldn't be any headlines or images. – s1lv3r Feb 23 '13 at 18:04
<header>, yes. And you are right. It should be <hgroup>. But what about that? Can there be anything else than <h>-tags inside? – Sebastian Starke Feb 23 '13 at 18:13
up vote 0 down vote accepted

The w3 specification says that only h-tags are allowed inside of the hgroup-tag. The basic purpose of it is to group a main-headline and a sub-headline together.

  <h1>My maintitle</h1>
  <h2>Subtitle of my content</h2>

edit html5 also adds the header-tag to use within the body. Inside of this any other html element is allowed. You just shouldn't confuse it with the head tag. :-)

share|improve this answer
If the specification says "typically contains" the headings, does it mean it can contain h-tags, depending on the context or it should contain them? When do I know if an element belongs there or not. The image for example. In my case the image is a 155px small circle with a person in it. In my feeling it is a header-thing. But if I would place it there, where would I stop placing things inside the header? Someone could feel like the meta information belongs there. Others could come up with the idea of placing the first paragraph inside. Is there any recommendation? – Sebastian Starke Feb 23 '13 at 19:00
hgroup = header group is an element that groups header .. so per definition it can only contain headings. :-) A heading (h1-h6) is allowed to contain any 'phrasing' element (dev.w3.org/html5/markup/common-models.html#common.elem.phrasing), this also includes images. Most developers simply use the w3c validator (validator.w3.org) to check their code. Anything that doesn't throw an error there is generally seen as OK. :-) – s1lv3r Feb 23 '13 at 19:15
Oh sorry, I was talking about <header>, the specification says it "typically" containes h-tags. And I know that it would be valid, but is it according to what the <header>-tag was meant for? – Sebastian Starke Feb 23 '13 at 19:18
Ah ok, regarding the header tag you are technically free to use almost any element inside of it. Regarding semantics you are supposed to place introductive or navigational elements inside it. This can be h-tags, p-tags, images or any other element as long as it is for the above purposes. – s1lv3r Feb 23 '13 at 20:10
Thank you very much. – Sebastian Starke Feb 23 '13 at 20:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.