WordPress uses microformats, for example, when we use the function post_class() in the DIV containing the article. It automatically includes the class called hentry, which is used in microformats. This is the structure:

  1. hentry
    1. entry-title
    2. updated
    3. published
    4. author
    5. ...

So the use of the microformats is really easy, it's only needed to use it as classes in the code.

BUT the problem is when we have to use the entry-title class out of the hentry class, specifically above the content. A lot of WordPress themes use this structure:

<!--The TITLE and the breadcrumbs-->
<section id="title">
<div class="wrap">
    <h1 class="headline entry-title"><?php the_title(); ?></h1>
    <?php if (function_exists('mybread')) mybread(); ?>

<!--The content-->
<div class="main-content">
<div class="wrap">
<div class="<?php content_layout(); ?>">
    <?php if (have_posts()) while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); //The HENTRY class is here ?>  >
        <!--The content is here...-->

With this layout it's impossible to use entry-title into hentry. So Google Webmaster Tools returns the error of "entry-title missing".

I'm planning two solutions: to remove the hentry class using a filter, or to remove it and then insert it manually above the title.

How can I fix it?


If you're on a page by default The Loop will only run once so why not wrap your title and content in a container where you can have post_class() available? Start your loop at the top and end it before you get to your footer (or where ever you need to end it).

If you are on a blog format and are running the loop multiple times, you'll need to be in the loop anyway to use the_title() properly anyway so you should have access to post_class() anyway.

You could probably set it manually but then you would need to remove it from the post class which you can do by using the following:

function remove_from_posts_class( $classes ) {
    $classes = array_diff( $classes, array( "hentry" ) );
    return $classes;
add_filter( 'post_class', 'remove_from_posts_class' );

[1] Credits jrandomh

  • Yes, I was thinking about to create a bigger container. But then the hentry will group the sidebar and more elements: related posts, author information and comments; and I'm not sure if the classes inserted by the post_class function can group all these elements. (This is the page: demo.seozeta.com/sample-post-10. I can make a div from the header to the footer, for example). – Gerard Jul 24 '14 at 19:53
  • @Gerard according to the hAtom Wiki you can add author and author information to your schema so that shouldn't be a problem. It should ignore the sidebar and comments from my (limited) understanding. I believe that hentry is only included into post_class() instead of body_class() because you could potentially have multiple posts to take into account. Since this is a page (single "post") I believe you would be fine to include it above your content to include your title. – Howdy_McGee Jul 24 '14 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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