How to Add Schema.org Markup to WordPress for Better SEO

In this late 2014, I can say boldly say SEO has changed and schema.org markup is playing a super role for seo.

The days have gone when we used to optimize keywords with lots of anchored backlinks, make high keyword density etc.

Now SEO means serving better user experience. We have to make our blog semantic so anything to everything can understand it easily.

We can make blogs user friendly with rich contents, proper formatting, easy navigation etc. But what if we need to make it friendly for search engine crawlers?

So here comes schema.

What is Schema.org Markup?

schema org markup

First of all, we need to know what Schema.org says about this markup:

Schema.org provides a collection of schemas that webmasters can use to markup HTML pages in ways recognized by major search providers, and that can also be used for structured data interoperability (e.g. in JSON). Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results, making it easier for people to find the right Web pages.

So schema.org markup is some semantic codes (itemscope, itemprop and itemtype) that helps crawlers and bots to understand your HTML site structure and content properly. After using this markup your site will be so much easier for the search engines to understand.

What are the SEO Benefits of Schema.org Microdata?

Schema markups or microdata are added in the important html elements. Starting from header, body, footer, content and sidebar, there will be different markups.

The search engines crawl all these microdata to determine which element is about what. It is said that schema.org microdata explains what the contents mean, not just the name. So no doubt this is the best choice for se to understand a page like a human.

Adding these markups will make your site more semantic than others. That’s mean you site will be most prominent. So there is a sure fire chance to rank higher.

How to Implement Schema.org Markup to Your WordPress Site

Note: in this tutorial, you will learn how to add Schema markup using code. But, it can be done a lot easier with a plugin. Check out this post by WP Superstars on Schema and Rich Snippets plugins for WordPress

We all know, plugins have made it easier to run a wordpress site without any trouble. But unfortunately there is no such plugin that can implement this markup properly.

You won’t believe, I have searched for almost 5 hours at a stretch, but couldn’t find out a plugin that makes it properly. There were some plugins like Schema Creator by Raven but they were just adding a few of them.

So here I’ve come to make it easy for all. Now I will try to guide you on how to add this markup easily.

First of all, we will need the admin access of wordpress dashboard or the ftp login. Because we are going to edit the following files of the theme:

  1. header.php
  2. index.php
  3. single.php
  4. page.php
  5. footer.php
  6. sidebar.php

Editing header.php (Header Template)

First open up your header.php file from wordpress editor or the site ftp. Then make the following changes:

  1. Find:
    <body <?php body_class(); ?>>

    Replace with:

    <body <?php body_class(); ?> itemscope="itemscope" itemtype="http://schema.org/WebPage">
  2. Find:
    <header id="masthead" class="site-header" role="banner">

    Replace with:

    <header id="masthead" class="site-header" itemscope="itemscope" itemtype="http://schema.org/WPHeader" role="banner">
  3. Find:
    <h1 class="site-title">

    Replace with:

    <h1 class="site-title" itemprop="headline">
  4. Find:
    <h2 class="site-description">

    Replace with:

    <h2 class="site-description" itemprop="description">
  5. Find:
    <nav id="site-navigation" class="main-navigation" role="navigation">

    Replace with:

    <nav id="site-navigation" class="main-navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement" role="navigation">

Editing index.php (Homepage Template)

Open up your theme index.php and edit these lines:

  1. Find:
    <main id="main" class="site-main" role="main">

    Replace with:

    <main id="main" class="site-main" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
  2. Find:
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    Replace with:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  3. Find:
    <h2 class="entry-title">

    Replace with:

    <h2 class="entry-title" itemprop="headline">
  4. Find:
    <div class="entry-thumb">

    Replace with:

    <div class="entry-thumb" itemprop="image">
  5. Find:
    <time class="entry-time published" datetime="<?php the _time('c'); ?>>

    Replace with:

    <time class="entry-time published" datetime="<?php the _time('c'); ?>" itemprop="datePublished">
  6. Find:
    <span class="author-link">

    Replace with:

    <span class="author-link" itemscope="itemscope" itemtype="http://schema.org/Person" itemprop="author">
  7. Find:
    <span class="author vcard">

    Replace with:

    <span class="author vcard" itemprop="name">
  8. Find:
    <div class="entry-summary">

    Replace with:

    <div class="entry-summary" itemprop="text">
  9. Find:
    <div class="entry-content">

    Replace with:

    <div class="entry-content" itemprop="text">

Editing single.php (Post Template)

Open up your single.php and make these changes:

  1. Find:
    <main id="main" class="site-main" role="main">

    Replace with:

    <main id="main" class="site-main" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
  2. Find:
    <h1 class="entry-title">

    Replace with:

    <h1 class="entry-title" itemprop="headline">
  3. Find:
    <div class="entry-content">

    Replace with:

    <div class="entry-content" itemprop="text">
  4. Find:
    <time class="posted-on published" datetime="<?php the _time('c'); ?>>

    Replace with:

    <time class="posted-on published" datetime="<?php the _time('c'); ?>" itemprop="datePublished">
  5. Find:
    <span class="author-link">

    Replace with:

    <span class="author-link" itemscope="itemscope" itemtype="http://schema.org/Person" itemprop="author">
  6. Find:
    <span class="author vcard">

    Replace with:

    <span class="author vcard" itemprop="name">
  7. Find:
    <div class="entry-thumb">

    Replace with:

    <div class="entry-thumb" itemprop="image">
  8. Find:
    <div class="entry-content">

    Replace with:

    <div class="entry-content" itemprop="text">

Editing page.php (Page Template)

Open up your page.php and edit these lines:

  1. Find:
    <main id="main" class="site-main" role="main">

    Replace with:

    <main id="main" class="site-main" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
  2. Find:
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    Replace with:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
  3. Find:
    <h1 class="entry-title">

    Replace with:

    <h1 class="entry-title" itemprop="headline">
  4. Find:
    <div class="entry-content">

    Replace with:

    <div class="entry-content" itemprop="text">

Editing footer.php (Footer Template)

Open your footer.php and change these lines:

  1. Find:
    <footer id="colophon" class="site-footer" role="contentinfo">

    Replace with:

    <footer id="colophon" class="site-footer" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">

Editing sidebar.php (Sidebar Template)

Open up your sitebar.php file and change this line:

  1. Find:
    <div id="secondary" class="widget-area" role="complementary">

    Replace with:

    <div id="secondary" class="widget-area" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">

Important Notes Before Editing The Theme

  1. It’s always better to backup the theme at first. Because something wrong in it might make your website unusable. Or you can use a child theme besides the main theme. Otherwise, if you update the theme, the markups will be gone.
  2. The following changes have been made on a normal HTML5 structured theme. If your site is structured with basic HTML, you might find out related div to it. In fact, you can use the <span> tag if you wish which will have no output.
  3. Sometimes the main content part of your template might be called from another php file. In that case, you should also check content.php, content-single.php and content-page.php files and make the changes as well.
  4. There are more schemas you might want to include. You should check out its full list.
  5. You can test your markup from Google Structured Data Testing Tool.

Over to You!

Nowadays, 70% of seo can be done just with the on page elements. There is nothing safer than the on page optimization. So it’ll be the best choice to add schema.org markup to our wordpress sites expecting higher search rankings.

What do you think about schema? Let me know your thoughts.

Did you find this post helpful? Get our best business blogging tips via email (it's free)!

80 Comments

  1. meshmarketer December 13, 2014
    • Abrar Mohi Shafee December 13, 2014
      • meshmarketer December 13, 2014
        • Abrar Mohi Shafee December 13, 2014
      • Kyle Healey July 7, 2016
        • Adam Connell October 15, 2016
  2. Pat Fischer January 19, 2015
    • Abrar Mohi Shafee January 20, 2015
      • Pat Fischer January 20, 2015
        • Abrar Mohi Shafee January 20, 2015
          • Pat Fischer January 20, 2015
      • Pat Fischer January 20, 2015
  3. Sudip Majhi February 20, 2015
    • Abrar Mohi Shafee February 24, 2015
  4. Imran Nazir March 9, 2015
    • Abrar Mohi Shafee March 10, 2015
      • Imran Nazir March 10, 2015
        • Abrar Mohi Shafee March 10, 2015
  5. Matthew Priest, The Edinburgh April 15, 2015
  6. Asaf Barron April 15, 2015
    • Abrar Mohi Shafee April 17, 2015
  7. Furious Theme May 31, 2015
  8. Donald McLeman June 29, 2015
    • Abrar Mohi Shafee June 29, 2015
      • Donald McLeman June 30, 2015
        • Abrar Mohi Shafee June 30, 2015
          • Donald McLeman July 1, 2015
  9. Pieter Verburght July 5, 2015
    • Abrar Mohi Shafee July 6, 2015
      • Pieter Verburght July 7, 2015
  10. Pankaj kumar July 13, 2015
  11. Hi There July 13, 2015
    • Abrar Mohi Shafee August 2, 2015
  12. Justin Munce July 27, 2015
    • Abrar Mohi Shafee August 2, 2015
      • Nikki January 7, 2016
  13. Kelvin August 4, 2015
  14. Brian August 14, 2015
    • Abrar Mohi Shafee August 15, 2015
  15. Khayyam August 18, 2015
    • Abrar Mohi Shafee August 26, 2015
  16. Palla Sridhar August 22, 2015
    • Abrar Mohi Shafee August 26, 2015
  17. Adam Garratt September 13, 2015
  18. Tausif September 15, 2015
    • Abrar Mohi Shafee September 16, 2015
  19. Shubham September 18, 2015
    • Marketing Tops December 16, 2015
  20. John-Paul September 25, 2015
  21. Lazlo @Yolo Seo September 29, 2015
  22. Hjl86 October 13, 2015
  23. Tatig November 20, 2015
  24. Sunipeyk November 26, 2015
  25. Rafe November 27, 2015
  26. Faisal Jamal December 18, 2015
  27. Ben December 21, 2015
  28. Gulshan Kumar December 23, 2015
    • Prakhar September 8, 2016
  29. Jamaluddin Rahmat January 25, 2016
  30. Annie February 2, 2016
  31. mandeep February 4, 2016
  32. Naveen February 4, 2016
  33. Gulshan Kumar February 5, 2016
  34. David Marchione February 27, 2016
    • David Marchione February 27, 2016
  35. Scott March 7, 2016
  36. Lascelles Clarke March 23, 2016
  37. Farhan March 28, 2016
  38. Tranyar April 6, 2016
  39. THU THUAT April 6, 2016
  40. Susmitha Sanjay April 28, 2016
  41. Craig June 23, 2016
  42. Swapnil September 12, 2016
  43. Chris September 13, 2016
  44. Responsive Miracle September 17, 2016
  45. Murat Tekmen September 23, 2016

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This