Site logo

Archived topic

Schema markup in copyright section

3 replies · Started by maria on July 25, 2019

Viewing posts 1–4 of 4

I'm trying to add schema markup to the custom footer/copyright section, but it's getting stripped out. Is that how it's supposed to work or is this a bug? This is the code that I've put there:

<div itemscope itemtype="http://schema.org/Dentist">%copy% <span itemprop="name">NAME OF COMPANY HERE</span> %current_year% </div>

Hi there,

It might not like the HTML attributes, I'll look into that.

For now, try using a filter instead:

add_filter( 'generate_copyright', function() {
    ?>
        <div itemscope itemtype="http://schema.org/Dentist">&copy; <span itemprop="name">NAME OF COMPANY HERE</span> <?php the_date( 'Y' ); ?> </div>
    <?php
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know if that works or not :)

That worked, thanks. The schema markup code is now there. However, the year was showing as 2014, so I hard-coded it to 2019. I'm guessing that this has to do with the system date in the staging environment.

Yes, that's likely it :)

Glad I could help!

This archived topic is closed to new replies.