Oxygen Builder PHP Schema
-
Dear Support,
we use Oxygen Builder to echo out our Schema Data in JSON. The default version is working but the translated version echo out:
<script type="application/ld+json">null</script></div>
The PHP that isn’t working is:
<?php global $woocommerce; $product = wc_get_product( get_the_ID() ); if ( $product === false ) { return; } $schemades = strip_tags($product->get_description() ); $schemaprod = $product->get_name(); ?> <script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Product", "name" : "<?php echo addslashes($schemaprod); ?>", "description" : "<?php echo addslashes($schemades); ?>" } </script>
I get following PHP warning as well:
Warning: Invalid argument supplied for foreach() in wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Parser/Check/Regex/JsonChecker.php on line 108This PHP code is working:
<?php global $woocommerce; $product = wc_get_product( get_the_ID() ); if ( $product === false ) { return; } ?> <script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Product", "name" : "<?php echo addslashes($schemaprod); ?>" } </script>
I already tried to strip away the special characters but that doesn’t work as well. The following HTML/JSON gets echo out in the default language:
"description" : "Edelstahl trifft Segeltau. Die „OSKAR“ in marineblau rot weiss. Kompromisslos, stabil im maritimen Look. gepaart mit einem verkapselten Edelstahl-Magnetverschluss – entwickelt & konstruiert von Brand®. extra starker Halt 6mm Ø (Segeltau Durchmesser) handgefertigte & passgenaue Qualität nickelfrei wasserfest & rostfrei beständige & abriebfeste Gravur Kompassgravur im Verschluss komfortabel & anschmiegsam für Damen und Herren zügig geliefert im schicken Geschenkkarton ",
Thank you very much,
Robert
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Oxygen Builder PHP Schema’ is closed to new replies.