0

I have a json schema code that I need to use it for all posts

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://akhbarejadid.com/457881/" }, "headline": "title", "description": "this is a test description", "image": "https://media.imna.ir/d/2021/07/15/4/1713968.jpg", "author": { "@type": "Person", "name": "Javad" }, "publisher": { "@type": "Organization", "name": "Akhbarejadid", "logo": { "@type": "ImageObject", "url": "https://akhbarejadid.com/wp-content/uploads/2021/05/logoakhbarejadid.png" } }, "datePublished": "2022-03-01", "dateModified": "2022-03-16" } </script> 

Can I use wp codes like the_title(); or the_author(); or the_content(); for this json schema? For example :

"headline": "<?php the_title(); ?>", "description": "<?php the_excerpt(); ?>", "image": "https://media.imna.ir/d/2021/07/15/4/1713968.jpg", "author": { "@type": "Person", "name": "<?php the_author(); ?>" 
2
  • Sure. You just need to create a child theme and add the code you desire there, so it doesn't get overwritten when you update your parent theme. Commented Mar 16, 2022 at 20:52
  • Use Slim SEO Schema which supports custom JSON-LD and dynamic variables wpslimseo.com/slim-seo-schema Commented Jan 17, 2023 at 8:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.