How to add custom Schema to some specific AMP posts?
-
Hello,
I have added in my theme this function:
<?php $schema = get_post_meta(get_the_ID(), 'schema', true); if(!empty($schema)) { echo $schema; } ?>
which allows me to add custom fields to the posts I want. For example… I have some posts (not custom posts) which describe services. And for them I need to add custom schema code.
This words well as you can see here: https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Fwww.anahatatantra.com%2Fpl%2Fkama-marma-masaz-tantryczny%2F
In that post, the “Service” is added manually as a custom field.However, in the AMP page, it’s not there.
https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Fwww.anahatatantra.com%2Fpl%2Fkama-marma-masaz-tantryczny%2Famp%2FHow can I add the same codes to the header of the AMP pages?
Maybe I have to edit this function in some way?
Or maybe it’s possible to add another specific function just for AMP pages? (I would prefer the first option, because these code snippets apply to both amp and non-amp.Thanks
The page I need help with: [log in to see the link]
- The topic ‘How to add custom Schema to some specific AMP posts?’ is closed to new replies.