WordPress Themes Blog Oh! Blog


In the world of computer programming, schema can be defined as the overall structure for a database. As per the Schema.org website, Schema markup is the code that you integrate with your website to help the search engines return more informative results for your users. If someone has ever used rich snippets, they’ll understand exactly what schema markup is all about. When you include content in your HTML pages, the search engines see it as plain textual content. They don’t know the content’s relevance or what the content is all about.

Schema tells the search engines what your data means and also helps structure your data. For example, when you post an article on your website and include the author’s name in the meta data, only you will know that the mentioned person is the author of the article. In order to make the search engines identify the author, you must include some kind of markup code around the author’s name and this is exactly what Schema.org empowers you with. Schema is a type of ‘rich snippet’ or HTML markup that adds extra information to the relevant content in a search result.

“In general, the more markup there is – schema, video or whatever – the easier it is for search engines to be able to interpret what really matters on a page,” – Matt Cutts.


To better explain the Schema concept, here is a funny image of a cat. I and you know it’s a cat, but a person who has never seen a cat in his life, doesn’t know anything about it. Consider the search engines as this novice person. The search engines only see it as an image and they try to pull relevant information from the ALT tag. To make this picture more search engine friendly, we have to put some indicator on the cat (a hat with”CAT” written all over it in this picture). So, when using the Schema Markup code, we are actually putting visual sensors for search engines. I hope that explains it better.

Why to Use Schema Markup?

A very small percentage of websites have integrated Schema Markup in their code till now, but despite the low number of sites carrying Schema integration, Google still delivers schema-generated markups in nearly 37% of search results. Adding the relevant Schema markup will make your website more semantic and prominent in the eyes of search engines. Also, there is a sure chance to rank higher on the search engines in the near future.

“Pages with Schema markup rank four positions higher in search results” – Searchmetrics.

Adding Schema to a WordPress Theme

A WordPress theme doesn’t contain Schema Markup by default. In order to add it to your theme, you should read the following steps and implement them.

1. First, we have to broadly define the page type for which we are adding the Schema Markup. According to the Schema.org website, a page can be an article, profile page, blog, search results page or just a general webpage. To do this, we must include this function in our functions.php file of the applied WordPress theme. With the help of this function, we can dynamically declare the page type for each kind of WordPress template.

function html_schema()
    $schema = 'http://schema.org/';

    // Is single post
        $type = "Article";
    // Is blog home, archive or category
    else if(is_home()||is_archive()||is_category())
        $type = "Blog";
    // Is static front page
    else if(is_front_page())
        $type = "Website";
    // Is a general page
        $type = 'WebPage';

    echo 'itemscope="itemscope" itemtype="' . $schema . $type . '"';

The above code defines your single posts as an ‘article’ type of page. If you are using a static front page, then that will be defined as a ‘website’ and if you have your blog posts on the home page, it shall be defined as a ‘blog’ page type. If none of the conditions are true, it will be a generic ‘webpage’ type.

2. Open the header.php file from your WordPress theme and find the <html> tag at the beginning of the template. Now, call the function defined in the first step. So, your <html> tag should look something like this :-

<html <?php html_schema(); ?>>

3. In the header.php file, find the <title> tag and insert itemprop=”name” to define the name for your webpage/blog/website.

<title itemprop="name"><?php wp_title(''); ?></title>

This will set the name for your blog, website or webpage pulling it from the site title.

4. Again in the header.php file, find your logo(text or image) that is linked to your home URL. We will use the markup itemprop=”url” to set URL for the webpage/blog/website.

<a href="<?php echo get_option('home'); ?>/" itemprop="url"><?php bloginfo('name'); ?></a>

5. Now we need to define the site navigational elements. In order to do that, find the navigation menu (most probably in the header.php file) that is encapsulated in a <nav> or <div> tag  and insert itemscope itemtype=”http://schema.org/SiteNavigationElement” to make it appear somewhat like the following code. Any links wrapped in this will become the Schema Navigation Elements.

<nav itemscope itemtype="http://schema.org/SiteNavigationElement">

6. In order to mark up the navigation links using Schema, we need to add a function to the functions.php file. This will add itemprop=”url” markup to each link in the navigation menu.

add_filter( 'nav_menu_link_attributes', 'add_attribute', 10, 3 );
function add_attribute( $atts, $item, $args )
  $atts['itemprop'] = 'url';
  return $atts;

7. For a blog post type, you have to use the markup itemscope itemtype=”http://schema.org/BlogPosting” itemprop=”blogPost” to define it as a blog posting. Include this code in the <article> or <div> tag after your WordPress loop begins. Your post title, content, meta data etc. should be encapsulated within this markup code. Following is an example of how it should work.

<article itemscope itemtype="http://schema.org/BlogPosting" itemprop="blogPost">

8. Now in the post content we need to add markup code for the headline, URL, date of publishing, content and image. In order to do this, follow the code below.

For headline and URL (permalink) put itemprop=”headline” and itemprop=”url”.

<h2 class="post-header" itemprop="headline">
<a href="<?php the_permalink() ?>" rel="bookmark" itemprop="url"><?php the_title(); ?></a>

For the featured image inside your post or article, add itemprop=”image” inside the <img> tag like this.

<img src="" itemprop="image" />

For the date of publishing, add  itemprop=”datePublished” around the post date.

<span itemprop="datePublished"><?php the_time('F jS, Y') ?></span>

For textual content, add itemprop=”text” in the surrounding <div> tag around your content or excerpt.

<div itemprop="text"><?php the_excerpt(); ?></div>

So, by now you should have a fair idea of how to use Schema Markup codes in your WordPress Theme. You can use the Google’s Structured Data Testing Tool to check if you have integrated Schema into your website efficiently.

For more details, you should research on Google and also visit Schema.org website. And if you need personal help in setting up Schema for your website, you can contact me.

  1. fakaza left a comment on March 5, 2019 at 4:18 am |

    This is a nice and educative topic  fakaza Have no other choice then to admit

  2. Rose Rogers left a comment on March 4, 2019 at 6:05 am |

    How to Buy Best customized WordPress Themes? There are so many new sites for latest WordPress customized themes, Cheap Essay,but before you have to decide to buy it we require to have genuine and solid review on that themes so where can I go for purchase demands on best word-press theme review only and buy the most suitable one?

  3. juicy left a comment on February 26, 2019 at 11:18 am |

    thanks you have solved my problem. These schema markup codes are what I really needed.

  4. fakaza2018 left a comment on February 18, 2019 at 3:41 am |


    grate job ecco more of life download   thanks Ecco you rock.



  5. Hoog left a comment on February 9, 2019 at 11:28 am |

    This is a cool stuff

    Download Ex Global I Get Better With Time

    many dudes will surly like this

  6. Hoodmsn left a comment on February 6, 2019 at 12:04 pm |

    nice one fakaza thanks
    for all the works

  7. JAMB Runs left a comment on February 5, 2019 at 11:54 am |

    JAMB Runs 2019 Thanks for this, you guys should see this.

  8. 2019 WAEC Expo left a comment on February 5, 2019 at 11:30 am |

    Thanks guusy for this.

    2019 JAMB Expo Runs

  9. zizijam download left a comment on February 4, 2019 at 12:31 am |

    fakaza appreciate you admin

  10. zizi left a comment on February 4, 2019 at 12:30 am |

    fakaza also notice that it will be of great need to the public

  11. Hasilbertapa left a comment on January 25, 2019 at 4:47 pm |

    Do you have newsletter feed to follow up by email?

  12. Call Girls in Bangalore left a comment on January 17, 2019 at 1:27 am |

    Looking at this article is extraordinary for us, I am eager to move forward in my next article. I want to spoil your articles, I want to explore your next post.

  13. Amanda Jordan left a comment on January 16, 2019 at 4:48 am |

    For the programmer people out there who have complete knowledge about Adobe Flex and MXML need urgent help? When I learned more about how I make my own mark-up language so I have to learning XML Schema is must for mark-up language. My Website Link http://www.CheapEssay247.com

  14. Shane Eagle Never Grow Up EP on sahiphop.org left a comment on December 29, 2018 at 1:12 am |

    i want to really learn how to do my own unique theme

  15. shane eagle left a comment on December 29, 2018 at 1:10 am |
  16. Paschal left a comment on December 28, 2018 at 2:16 am |

    i really appreciate all the help Pat… https://sahiphop.org

  17. Shane Eagle Never Grow Up EP on sahiphop.org left a comment on December 28, 2018 at 2:10 am |
  18. Christopher left a comment on December 26, 2018 at 6:39 am |



  19. telemedical left a comment on December 14, 2018 at 2:36 am |

    ver más aqui

  20. Sjava Umqhele ALbum On hiphopza.com left a comment on December 9, 2018 at 10:13 am |
  21. Chris Nwosu left a comment on November 21, 2018 at 4:53 pm |

    I really need the schema markup codes, since I started my blog, I have been using wordpress.

  22. JAMB Runs 2019 left a comment on November 20, 2018 at 8:08 pm |

    Thanks for this wondeful thread.
    JAMB Runs 2019

  23. fakaza2018 left a comment on November 7, 2018 at 8:19 am |

    Fantastic Post! Great advice, I’ve been slacking on implementing this on a few websites. One word of caution is to be careful if your theme already has this stuff or not.

  24. Cassper Nyovest left a comment on October 29, 2018 at 7:44 am |

    Hello Patrick… Thanks for the info, Integrating Schema to my website has been a major problem for me, thanks for the help…


  25. SavovDesign left a comment on October 16, 2018 at 2:47 am |

    Very useful information. Thank you for the explanation for Schema markup for WordPress. I integrated the code into my website and it works well – https://savovdesign.com/

  26. Sam left a comment on June 23, 2018 at 5:18 am |

    Good blog you’ve got here.. It’s difficult to find excellent writing like yours these days. I really appreciate individuals like you! Take care!! Facetime for PC An exclusive computer system application which comes preinstalled in every Apple products, while it’s an iPhone, iPad or perhaps a Mac book – https://facetime4pc.com/

  27. daintree residences left a comment on June 4, 2018 at 9:35 am |

    I used to be abnle to find good info from your articles.

  28. Dalian Huagong Innovation Technology Co., LTD. left a comment on May 25, 2018 at 3:27 am |

    Very good information and will continue to follow

    Huagong Innovation Technology Co.,Ltd.HGIT is a professional provider of polyurethane automatic equipment and sealing system solutions.The company is located in the beautiful coastal city —Dalian. HGIT equipment of Huagong has a number of independent intellectual property rights,and also has the features of stable,secure,reliable etc. E-mail?hgcx@vip.163.com,info@hgcx.cn TEL? +86-411-39525022 FAX? +86-411-39525009 Website?http://www.hgcx.cn/en foaming machine CNC PU Seal Pouring Machine Foam sealing gasket machine Injection (Potting) Machine barrier-strip foam technique Spraying cementing machine Foam sealing machine (FIPFG) PU gasket sealing machine Warm Edge Spacer Forming Machine

  29. jamb 2018 left a comment on October 26, 2017 at 6:06 pm |

    thanks for throwing more light onb schema markup i learnt alot

  30. Jane left a comment on September 21, 2017 at 6:29 pm |

    Am a WordPress user also, thanks for this,nits really helpful. ..

  31. swati left a comment on September 18, 2017 at 1:25 am |

    Nice article and after studying you article i am able understand more about scheme

  32. stickman left a comment on September 6, 2017 at 9:35 pm |

    Very useful info, thanks

  33. sania jaan left a comment on March 17, 2017 at 12:20 pm |

    I have a question, how to display post with image in search engine, I have searched many sites, but I could not find the answer please guide me.


  34. Roon left a comment on January 8, 2017 at 5:08 am |

    Hello Jai, is it possible to show automatic tables in search engine with these schemas?
    I am stuck in this. Please tell.
    Roon (hotstar)

  35. Sarath left a comment on December 28, 2016 at 6:12 am |

    I find your article really nice. Thanks for sharing this tip, I am thinking of integrating schema.org in my website http://www.inoover.com.


  36. webtady left a comment on September 28, 2016 at 3:53 pm |

    Thank you for your brief explanation for Schema markup for WordPress. Really appreciate it.

  37. Kodden left a comment on April 19, 2016 at 6:49 pm |

    Hello! Thanks for sharing, trying to learn how to implement in my site.

    One doubt: I have a local business site with some pages that describe the service, which schema.org is best for this kind of pages? Blog/Website/Webpage

    I’m using Zerif theme any tips ?

    Thank you!! Best Regards

  38. Guide Us Online left a comment on April 9, 2016 at 9:57 pm |

    very nice information after watching my website on google webmaster tool and found that the schema.org and after a long search it is ended now, thanx for sharing this awesome information.

  39. Abdul Haseeb left a comment on March 24, 2016 at 11:34 am |

    I want to show my site’s favicon (http://domain.tld/favicon.ico) with each of my post in google search result. Can you give some code or tell me what should be modified in above code for this purpose, plz?
    >I’m using wordpress.
    >Yoast creates og: meta tags.
    >I also have my favicon in png format 500 x 500.
    >My every post has one or more embeded video(s) like Movie Trailers etc.
    >I prefer embedding dailymotion videos.

  40. MohammedTahir left a comment on March 15, 2016 at 7:13 am |

    Amazing tutorial. I was just moved our companies website from html to WordPress and wondering how can i use markup now? thanks you have solved my problem.
    I have one more question: How can i add itemprop=”articlebody”. in my single blog post?

  41. sunipeyk left a comment on October 15, 2015 at 12:46 am |

    Thank you for your brief explanation for Schema markup for WordPress.

    With your permisson i want to add a minor correction for the publish date;

    <span itemprop="datePublished" content="">
    php the_time( ‘c’ ); part is a must for structured-data/testing-tool for google.

  42. ZT Mesh left a comment on September 1, 2015 at 8:14 am |

    I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.

  43. Sanjeev left a comment on July 16, 2015 at 11:03 pm |

    Hello, Good tutorial. But i am trying to testing my site on Google Structure tool to find my theme has schema markup implementation by default or not, but don’t know the correct option there. Can u helps me?

  44. Steven Gluyas left a comment on June 27, 2015 at 5:58 am |

    I building a new site and it is not yet live…….what is the cost for you to put the code in for me? i am not too good at doing the php thing and would hate to screw it up


  45. Eduncle for education left a comment on June 27, 2015 at 4:34 am |

    I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.

  46. Patrick Coombe left a comment on June 25, 2015 at 11:51 pm |

    Fantastic Post! Great advice, I’ve been slacking on implementing this on a few websites. One word of caution is to be careful if your theme already has this stuff or not. Also FYI – this post was shared on Inbound:


    • Jai left a comment on June 26, 2015 at 12:12 am |

      Hi Patrick, Thanks for the appreciation. Yes, people have to be careful that Schema hasn’t already been integrated into the theme (highly unlikely). Also, I know about the Inbound link (I shared it there 🙂 ). Feel free to share the post in your social network.

Leave a Comment to Sanjeev

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

What Others Say

BannerJai was awesome to work with. A port of an ASPX/HTML site to Wordpress went seamlessly, and his recreation of our look and feel were fantastic - Kevin Webster

BannerJai is a talented, creative and an enthusiastic web developer who has worked consistently to deliver high quality websites for my businesses - James Eccles

  •   Let’s Talk

    "Thank you for visiting my website! In order to start a project with me, please send me information on your project so I can figure out how best to help you."

    "After your initial contact, I’ll schedule a quick one-on-one session via Skype to review the project and get to know you."
     Request a Quote
Need a Custom Website?

Leave a Feedback

Tell Me About Your Project