Remove WordPress hentry Class from Pages

Google’s Structured Data Testing Tool is strictly interpreting the use of the hentry class.

The hentry class is for date-stamped content intended to be syndicated, like blog posts. WordPress automatically adds the hentry class with the post_class function. Often post_class is used in templates like this:


<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

hentry Error in Google’s Structured Data Testing ToolMany WordPress themes, even WordPress default themes, use post_class on all content, including pages. WordPress pages, as opposed to posts, don’t usually include a date and author because pages are not date based. Google’s Structured Data Testing Tool sees the hentry class and expects to see date and author, so it lists errors. When Google lists errors, webmasters pay attention.

Remove WordPress hentry Class from Pages

To remove the hentry post class only from pages, this can be added to your theme’s functions.php:

function themeslug_remove_hentry( $classes ) {
	if ( is_page() ) {
		$classes = array_diff( $classes, array( 'hentry' ) );
	}
	return $classes;
}
add_filter( 'post_class','themeslug_remove_hentry' );

The screen grab below shows an example of how items with errors in the structured data report in Google Webmaster Tools drops to zero after removing the hentry post class.

hentry Structured Data Errors in Google Webmaster Tools

Should the WordPress core stop adding the hentry class to pages to satisfy Google’s strict interpretation of structured data?

Contribute to the WordPress Support Forum

Because it is an open source project, there are many ways to contribute to WordPress. Some people write code or fix bugs. Some translate WordPress or plugins into their language. Some present at a WordCamp.

My contribution is to volunteer in the WordPress support forum. A weekly calendar task reminds me to visit the support forum and see if I can help solve someone’s problem. I have learned a lot over the years from others sharing their knowledge. Now I try to give back.

WordPress Support Forum

The “No Replies” list is a good place to start because those posts do not yet have a response.

One of the pitfalls is replying to a support post that turns out to need more help than expected. These support posts need to be seen through to a resolution because the post has been kicked out of the “No Replies” list, so the likelihood that someone else will jump in to help is low.

It’s a great feeling to help someone get unstuck, and to contribute to the WordPress community.

SEO Checklist for WordPress Blog Posts

There are many articles about search engine optimization for entire web sites, but this SEO checklist is for single blog posts published using WordPress. If you want to search engine optimize your blog posts, here’s how.

SEO Checklist

1. Write Valuable Information

The best thing for SEO is to write valuable content that people want to read. Give something away. Help someone. People will link to high-quality content, and if readers find value in your blog they will come back.

2. Choose Your Landing Page

Relate your blog post to a page on your website that you want to promote. That page is sometimes called a “landing page” or “cornerstone content”. Your blog post is an opportunity to bring attention to one of your products or services.

Include the keyword phrase for that landing page in your blog post, then in the blog post link that keyword phrase to your landing page.

3. Research Keywords

Use one keyword phrase for one web page or post. Don’t try to optimize more than one page for the same keyword phrase.

Use the Google AdWords Keyword Tool to get keyword ideas and see actual keyword usage. The AdWords tool is intended for people with a Google AdWords account, but you don’t need to be an advertiser to use it. The keyword tool shows a list of keyword ideas similar to the one you entered. The competition column shows which keywords advertisers think have most value. Other columns show how often people searched for a keyword.

Use Google Trends to compare search volume for a group of keywords. When writing this post, I found that people are searching “seo checklist”, so I used that. (Note that the longer and more specific your targeted keyword phrase, the easier it is to rank high.)

Google Trends for "seo checklist"

Check your Google Analytics and Google Webmaster Tools to see the keywords visitors are using to find your website. Build on your successes and improve your shortcomings.

4. Title the Blog Post

What do you want people to type into their search engine to find your blog post? Use that search phrase as part of your blog post title — preferably near the beginning. The title is what people will see in search results, so it should entice people to click. Use a unique title for each page or post on your website.

If you have edited your blog post title a few times, make sure your “pretty” permalink matches the title, includes the keyword, has words separated with hyphens, and has no junk words like “a”, “and”, “the”.

5. Keyword in Content

Write with your keyword in mind, but don’t contort your content to adhere to this SEO checklist. Quality content is most important.

Include the keyword phrase, and variants of it, in your content in these places:

  • First paragraph
  • Subheadings
  • Links to landing pages on your site, and in the link title tag
  • Links to high-quality pages off your site
  • Image file names and alternate text
  • Meta description

6. Categories and Tags

Assign the post to one or two categories and tags. Don’t over do it, and it’s helpful if the tags are words actually found within the post.

7. SEO Plugin

Install the excellent WordPress SEO by Yoast plugin. It will analyze your post and let you know if your content is targeting your keyword phrase. Here are just a few things it checks:

  • Snippet Preview: Shows how your post will look as a search result, showing the title, address, and meta description.
  • Focus Keyword: This is the phrase the plugin assesses your post against.
  • SEO Title: Typically you should leave this alone because your WordPress theme or SEO plugin will take care of the title tag automatically.
  • Meta Description: This is the snippet of page content that you want displayed in search results. It should include the keyword, be unique, and be enticing to click.

8. Publish

Hit that big blue “Publish” button.

9. Share It

Use social media like Twitter, Facebook, and LinkedIn to let the world know about your new blog post.

10. Google Analytics

Create a new annotation in Google Analytics, or your website analytic tool of choice, so you can easily see the publishing date of the blog post. This will help you track any changes in website traffic generated by the new post.

Conclusion

This SEO checklist for WordPress blog posts will help search engines accurately understand your content, and attract targeted readers to your blog.

How Much to Donate to a WordPress Plugin?

WordPress Plugin Donations?

My policy is to donate $5 to each WordPress plugin I use on a website.

Here’s a calculation that makes $5 look about right:

  • Say a plugin has 500,000 downloads
  • If 10% of those that downloaded used it, that would be 50,000
  • If 10% of those that used it donated, that would be 5,000
  • 5,000 donations times $5 is $25,000
  • Not bad for something given away freely

But not that many people donate to plugins, you say? True, but plugins are free and donation is optional. Also, I don’t want to try to make up financially for those that don’t donate.

Five dollars is very little, you say? You’re right, but it’s more than the average iPhone app at $1.99. And probably most people develop plugins for publicity, not direct profit.

We should donate to WordPress plugins because:

  • Website developers gain from being able to easily add sophisticated functionality to WordPress instead of building it from scratch
  • Profit will prevent the plugin developer from abandoning your favorite plugin
  • Most other people don’t donate to WordPress plugins
  • The plugin developer asked

Some thoughtful articles on plugin donations:

What are your thoughts on WordPress plugin donations?

Force Browser to Use Latest WordPress CSS

Have you ever made changes to your WordPress theme’s CSS file, then asked your client to have a look only to have them say they don’t see the change? Often it’s because their browser has cached the old stylesheet. So you ask them to empty their browser cache, or press f5 or command+R, and you hear silence on the phone.

First, I found this post by Mark Jaquith: Force CSS changes to “go live” immediately. This worked great for a long time, but now wp_enqueue_style() is preferred, so that solution no longer worked.

Here’s what I do now to enqueue a style sheet with a timestamp:

function themeslug_enqueue_style(){
   wp_enqueue_style( 'style', get_stylesheet_directory_uri().'/style.css', array(), filemtime( get_stylesheet_directory().'/style.css' ) );
}
add_action('wp_enqueue_scripts','themeslug_enqueue_style');