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 if(is_single()) { $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 else { $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"> <!--WORDPRESS NAVIGATION MENU--> </nav>
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.
<!--WORDPRESS LOOP BEGINS--> <article itemscope itemtype="http://schema.org/BlogPosting" itemprop="blogPost"> <!--POST CONTENT--> </article> <!--WORDPRESS LOOP ENDS-->
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> </h2>
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.
264 replies on “How to Add Schema Markup to a WordPress Theme”
I have been checking out a few of your stories and i can state pretty good stuff. I will definitely bookmark your blog
Nice knowledge gaining article. This post is really the best on this valuable topic.
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?
Great article. I’ve been using Weebly for a longtime. Looking to switch over to wordpress. Thanks for the info.
I really like this great post. Looking for more good posts.
Totally accept your suggestion
I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.
Cheers!
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
Thanks for this information, Actually, I am starting to learn schema mark up because I want to make my website looks good.
I was trying to put my schema in my website right now and knowing this will help me a lot! Thank you very much for sharing this article.
This is very educational content and written well for a change. It’s nice to see that some people still understand how to write a quality post.!
nice
A amazing post , and great work useful for me with informational post thanks for sharing keep continue
Great blog. Keep sharing.
Great advice. I’ve been thinking of moving some sites over and this may push me over the edge!
wow
so nice
nice to read
awesome
great
I am also using wordpress theme on my blogs. These schema markup codes are what I really needed
Very Informative Post
Nice article on scheme markup to a WordPress theme.
Nice One. Keep It Up
Your website is really cool and this is a great inspiring article.
What I love about this website is that you also post tutorials to those people who have no experience in this.
Do you also have any cute themes? Because I really like cute stuff.
Your website has been helpful for me for months now. Thank you so much!
Thank you for sharing such a great content.
Great post and very helpful.
Glad to found this website. Keep sharing.
Wonderful blog post ! Thank you for sharing with us .
I am really impressed the information you provided here on schema markup. Keep up the good work and looking for more.
This is great
This is a great inspiring article.I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
Excellent weblog, great work. Your idea couldn’t have most certainly been written any better.
This sis a great site!
Perfect !
Good !
Thank you for posting this! For a novice trying to learn how to build a website, there’s a pretty steep learning curve when it comes to WordPress.
Nice article, thanks for sharing!
Very well written article, I appreciate the enthusiasm and information! Thank you so much for sharing!
Wow, great article! it really helps me get a better insight with the detail.
This is an awesome idea!
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.
The information you have posted is very useful. The sites you have referred was good. Thanks for sharing..
Wow very good post, please dont stop posting things like this because ie really enjoy this
The effort of publishing this post. This has been really helpful.
I really don’t use themes but yours are amazing!
I never thought of this one. Thank you for posting this one!
Great! Thanks for sharing the information. That is very helpful for increasing my knowledge in this field.
Great write-up,
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
I would like to say that this blog really convinced me to do it! Thanks, very good post. Its really amazing
This site is amazing.
thanks for the list guys. it’ll really help me.
its very useful page …
i love it and i suggest it to read for everybody …
Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene.
hello!! Very interesting discussion glad that I came across such informative post. Keep up the good work friend. Glad to be part of your net community.
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..
your article is usefull and help me and h will use this in my new website
I definitely will be sharing this with my SEO friends. Thanks guys!
Love using Schema for my sites! Thanks for sharing!
It very informative and easy to understand. It will make my wordpress website more beautiful. I was was wondering if I could use this
I find your article really nice. Thanks for sharing this tip, I am thinking of integrating schema.org in my website
Thanks, Love it..
That’s a very good post, This post give truly quality information, I’m definitely going to look into it, Really very useful tips are provided here, Thanks for sharing.
Fantastic post! it is so informative, im impressed
This theme is really beautiful. Thank you for this work.
I visit it very often. Keep it up!
Thanks! I appreciate that you shared this to us! Will try to incorporate to our website!
super helpful post-thanks!
great info, t this will help me so much in my learning thank you for sharing.
Thanks for sharing this with us. Your blog posts are really very interesting and useful.
Thanks for sharing this with us. Your blog posts are really very interesting and useful.
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it’s quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards,
Quality articles is the secret to interest the users to pay a visit
the site, that’s what this site is providing.
I’m really enjoying the design and layout of your website.
It’s a veryy easy on the eyes which makes it much more enjoyable
Whaat i don’t understood is in fact how you are not actuqlly a lot more well-liked than you may be rightt now.
You are very intelligent. You understand thus consdiderably
Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.
I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent.
Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting.
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It ‘s really very nice and Useful post.Thanks
Admiring the time and effort you put into your blog and detailed information you offer!..
This is the best article, well writen, well organised, you did a great job on this.
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..
Admiring the time and effort you put into your blog and detailed information you offer!..
Schema is a very useful html code usually added the the website to improve the search rankings.
This paragraph gives clear idea for the new viewers of blogging! Regards from
Finally I can add Schema markup on my WordPress theme! Thanks for sharing this wonderful guide.
I enjoyed seeing this detailed work
This arcile was really interesting to read. It was very well structured and very well made. I want to see more articles like this one. Really liked it
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.
This is best article. when I read your article more data one of other blog entry. So I like it. Much obliged to you for offering this article to us…
Great Article it its really informative and innovative keep us posted with new updates.
This is a great inspiring article.I am pretty well pleased with your good work.
This article was really interesting to read. It was very well structured and very well made. I want to see more articles like this one.
The above tutorials work absolutely like a charm!
i like this post !
Hi Patrick, Thanks for the appreciation. Yes, people have to be careful that Schema hasn’t already
Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It ‘s really very nice and Useful post.Thanks
I read a article under the same title some time ago, but this articles quality is much, much better. How you do this..
Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future..
I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.
This is very educational content and written well for a change. It’s nice to see that some people still understand how to write a quality post.!
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.
I appreciate everything you have added to my knowledge base. Admiring the time and effort you put into your blog and the detailed information you offer. Thanks.
very interesting
Very good points you wrote here..Great stuff…I think you’ve made some truly interesting points.
I’ve been searching for some decent stuff on the subject and haven’t had any luck up until this point, You just got a new biggest fan!..
I really enjoyed reading this post, big fan. Keep up the good work and please tell me when can you publish more articles or where can I read more on the subject?
I really enjoyed reading this post, big fan.
Great Article it its really informative and innovative keep us posted with new updates.
what a nice post is this.
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.
Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks.
I have not any word to appreciate this post…..Really i am impressed from this post….the person who create this post it was a great human..thanks for shared this with us.
nice post
Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field.
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!
I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks.
Very good points you wrote here..Great stuff…I think you’ve made some truly interesting points. Keep up the good work.
Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us.
Hi, that’s so nice article. And as a webmaster, I admit that Schema markup is so important for today’s website. But there are many plugins which you can use for this purpose.
I love your site. Can you please post more articles like this?
You may stumble, may fail, maybe discouraged, but never give up. Please share great things with me
Thank you for your article. I love it.
This type of message always inspiring and I prefer to read quality content, so happy to find good place to many here in the post, the writing is just great, thanks for the post.
I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!
I found this is an informative and interesting post so i think so it is very useful and knowledgeable. I would like to thank you for the efforts you have made in writing this article.
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!
I love your post. Thanks
Your sharing is very useful. I have learned a lot from this article of yours. I will be back.
An awesome and informative article
I am not a developer but I think these WordPress are useful for a developer whose work is developing the websites
Great Article it its really informative and innovative keep us posted with new updates.
I really enjoy reading and also appreciate your work.
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..
You have a good point here!I totally agree with what you have said!!Thanks for sharing your views…hope more people will read this article!!!
great article
I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.
I love Nigerian music, this site really only works to learn.
Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article.
It proved to be Very helpful to me and I am sure to all the commentators here!
Your website is really cool and this is a great inspiring article.
The article is helpful
thanks this is good blog.
Very good points you wrote here..Great stuff…I think you’ve made some truly interesting points.Keep up the good work.
Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it’s quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards,
The information you have posted is very useful. The sites you have referred was good. Thanks for sharing..
This article was written by a real thinking writer. I agree many of the with the solid points made by the writer. I’ll be back.
How to add schema markup to WordPress themes is pretty cool and effective. Thanks for sharing this great way.
Thank you for some other informative blog. Where else could I get that type of information written in such an ideal means? I have a mission that I’m just now working on, and I have been at the look out for such information.
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!
This is actually the kind of information I have been trying to find. Thank you for writing this information.
Good post but I was wondering if you could write a litter more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it!
fantastic post. i really love it
thanks for sharing this
thanks for sharing this
Thank you for your brief explanation for Schema markup for WordPress. It’s an amazing one
I love this platform
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..
i love this platform so much
i love this article so much
please keep this up
Nice stuff in here. I’m happy I found this website, Thanks. I’m currently using this on my website and it works great.
Thanks for this tutorial.
what a nice post is this.
This is a great inspiring article.I am pretty well pleased with your good work. Looking to read your next post.
Waooo thanks for this great article Is so rich in content if not for here and now I never knew that “Schema markup is the code that you integrate with your website to help the search engines return more informative results for your users”
wow thanks for sharing is a great article
Great content will be implementing these tips on
hopping to read more of the amazing content
thanks for thanks your time to share this kind of amazing content it helpful to me
Thanks it was really great. wordpress it awesome!
Woow!! Nice One!
Cool
Nice article..
Wow. Great content. I learned from.
thanks for this usefull article, waiting for this article like this again.
Feel free to share the post in your social network.
this website is amazing very good design and a great article and good color and good info,thanks.
Hello! Have a nice day! Thanks for this website for easy to access and it has beautiful background.
Very well written content I really enjoyed it, I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.
will like to be here again
thanks for sharing this great information
Great Post. Thanks for sharing this with us. Your blog posts are really very interesting and useful. Hopefully this may also help your readers to do affordable online shopping. Ferns N Petal Discount Codes
Your current web-site is fairly quickly growing to be certainly one of my top feature. So, I just stumbled on creative weblog and I just need to state that this amazing is a nice blog post. Bless you pertaining to this kind of knowledge.
The above tutorials work absolutely like a charm!
Excellent post! finally someone has guided my to implement schema to my website.
God bless you
This is the type of information I’ve long been trying to find. Thank you for writing this information.
For programmers schema themes are very important because schema themes are better for good search rankings.
Therefore, i would also recommend to use schema themes.
Love this
This is wonderful.
Thanks for the tutorial
This is best article. when I read your article more data one of other blog entry. So I like it. Much obliged to you for offering this article to us…
Thanks for the tutorial
Great advice, I’ve been slacking on implementing this on a few websites
wow nice read
wow nice article
It’s really great to post my comments on such a blog.
Hi. First of all I would like to say what a great site you have.
Your blog posts are really very interesting and useful for us thanks for sharing.
This is a nice and educative topic
thanks you have solved my problem.
grate job
This is a cool stuff many dudes will surly like this
nice one
Thanks for this, you guys should see this.
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.
Cool info.
Nice one…
Nice update..
i really appreciate all the help
what a wonderful article.
I REALLY LOVE THIS ARTICLE
Love this article
Thanks a lot
I really need the schema markup codes, since I started my blog, I have been using wordpress.
Thanks for this wondeful thread.
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.
Thanks for the info, Integrating Schema to my website has been a major problem for me, thanks for the help…
Hello Patrick… Thanks for the info, Integrating Schema to my website has been a major problem for me, thanks for the help…
Very useful information. Thank you for the explanation for Schema markup for WordPress.
I really appreciate individuals like you!
Nice one though
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!
I used to be abnle to find good info from your articles.
Very good information and will continue to follow
thanks for throwing more light onb schema markup i learnt alot
Am a WordPress user also, thanks for this,nits really helpful. ..
That theme makes my work easy .
Nice article and after studying you article i am able understand more about scheme
wow i have learnt something this night. i can now do it on my own
Very useful info, thanks
Thanks guys. For this.
Good tutorial. I building a new site
I find your article really nice. Thanks for sharing this tip,
Thank you for your brief explanation for Schema markup for WordPress. Really appreciate it.
Hello! Thanks for sharing, trying to learn how to implement in my site.
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.
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?
Thank you for your brief explanation for Schema markup for WordPress.
Nice
I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.
Cheers!
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?
what a nice post is this.
I gotta favorite this website it seems very helpful.
Love what you’re doing here guys, keep it up!..
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
Thanks
Steven
If you set out to make me think today; mission accomplished! I really like your writing style and how you express your ideas. Thank you.
I would like to say that this blog really convinced me to do it! Thanks, very good post.
This is my first time i visit here and I found so many interesting stuff in your blog especially it’s discussion, thank you.
Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers!
I am also using wordpress theme on my blogs. These schema markup codes are what I really needed, Keep the great work up.
Cheers!
This is a great post. I like this topic. This site has lots of advantages.I found many interesting things from this site. It helps me in many ways. Thanks for posting this again.
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.
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.
I like this post,And I guess that they having fun to read this post,they shall take a good site to make a information,thanks for sharing it to me.
I would like to say that this blog really convinced me to do it! Thanks, very good post.
Totally agree. can someone check my site