Google Structured data in Divi theme

Question:

WordPress comment

I recently got a comment from James asking if there is any way to add Structured data to the Divi theme without using any plugin so I decided to answer his question with this tutorial ( that Including a bonus child theme) [ excited 🙂 ] .

In this tutorial, I have three ways for you:

  1. I will first explain the whole code and its output source.
  2. I have also made a child theme out of it which you can download at the end of this article.
  3. What to do if you are already using a child theme or you don’t want to use the child theme.

If you are wondering what structured data is, then you should read this article first and then come back to this tutorial for the proper understanding.

Let’s take a dive into the code:

Structured Data Cheat Sheet by Ahmed Kaludi

This code has integrated WordPress functions and tags that will automatically get the data and display it in their respective JSON+LD tags…… except one part, the ImageObject of the Logo.

structured-data-logo image object

You must change the URL “https://ahmedkaludi.com/logo.jpg” with your own logo URL but make sure that the height of the logo is 60 pixels, that is required by the Google Structured Data.

Here is the full source code hosted on the Gist.

Of course, you need to having some development knowledge in order to implement this code properly.

But…

2. Divi Structured Data Child Theme

structured-data-headline

Yes, there is always a but!, If you don’t have enough development knowledge to understand this code or you are just lazy like me, then I have prepared a child theme with all the code integrated and tested with the Divi theme.

Download Divi Structured Child Theme

You can just install this theme to your WordPress site ( from Appearance > Themes > Add New > Upload ) and then activate it. Your WordPress site will have the structured data integrated automatically to your blog posts.

3. What if I’m already using a Child theme or don’t want to use a child theme?

In that case, you can paste the below code into your functions.php file of your child theme (or god forbid, ” to the parent theme”) and the structured data should be integrated into your Divi WordPress theme.

Over to you!

Obviously, I will need your feedback and suggestions on this. As well as some tips from your side that you can share with us. How do you leverage the structured data on your site? You can leave a comment or directly ask questions by emailing me on ahmed@ahmedkaludi.com

OUR SITES

Magazine3.Company AMPforWP Magazine3 Themes