Schema Markup Code Wordpress

If you are looking to add Schema Markup to your wordpress website then this is the post for you. The best part is, with this quick guide, you will able to generate schema markup of any kind without using any WordPress plugins.

Add Schema Markup Code to WordPress Header file

Before anything else, you need to add the following code to the header.php file of your WordPress website. For safety purpose, I recommend taking a backup of the file beforehand in case you make any mistakes in pasting the code in header.php file.

Here’s the code:

<!-- Schema Code from TOPITGUY.com -->
<?php wp_head(); ?>
<?php
$schema = get_post_meta(get_the_ID(), 'schema', true);
if(!empty($schema)) {
echo $schema;
}
?>
<!-- End of Schema Code -->

Watch this video and do exactly what I did to paste the code in header.php file:

The code needs to be added before the closing of Head tag. The above video shows you the correct way to do it.

Enable Custom Fields From WordPress Preferences to Add Schema Field

Although if you have watched the above tutorial, you already know how to enable custom fields. If you have not, then you can do it following these steps:

  1. Go to the any post
  2. Click on three verticle dots in the right corner above
  3. Go all the way down and click on preferences
  4. From the three option, select Panels
  5. Inside Panels, make sure the Custom Fields option is switched on
  6. Click on Enable a Reload
  7. Now below the content area of post, you will see new option “Add Custom Field” click on “Enter New”
  8. In the Name Field add “schema” and in Value field your Schema Markup (You can generate your Schema markup using technicalseo.com)

After entering the markup code, simply hit publish. After few minutes, just go to Schema.org to validate the implemented schema markup. And, that is all there is to it.

If you have any questions and need help with Schema Markups, feel free to reach me!

The post How to add Schema Markup to your website without Plugins appeared first on TopITGuy.com.

This content was originally published here.

Scroll to Top