I use a custom fields plugin for posts and use the review schema. I use it this way with a PHP extension.
the schema i used in the post:
code in php plugin:
<?php
$schema = get_post_meta(get_the_ID(), 'schema', true);
if(!empty($schema)){
echo $schema;
}
?>
I use it in the elementor header like this:
[xyz-ips snippet="schemacode"]
My problem here is that I want this schema to appear only in the post, but it also appears in the post's categories. I tried this in if loop but it didn't work:
if(!empty($schema) && get_post_type() === 'post'){
echo $schema;
}
How can I exclude categories? Thanks.