Hi. I want to include json-ld on homepage and post page. This is the code:
<?php
function post_thins_in_footer() {
global $wp_query;
if ( is_single() ) {
if ( have_posts() ) {
?>
<script type="application/ld+json">
<?php
while ( have_posts() ) { the_post();
?>
"@context": "https://schema.org"
etc
<?php
}
?>
</script>
<?php
}
}
if ( is_home() ) {
if ( have_posts() ) {
?>
<script type="application/ld+json">
<?php
while ( have_posts() ) { the_post();
?>
"@context": "https://schema.org"
etc
<?php
}
?>
</script>
<?php
}
}
}
add_action( 'wp_footer', 'post_thins_in_footer' );
It works, but I’m not sure if it’s ok to use it in a theme that I want to upload on ThemeForest…
Is this code a reason for a hard rejection?