Search code examples
phpmetaschema.org

PHP grab content function, inside meta tags?


I'm trying to improve my site structure, per Schema.

So I have:

<div class="post">
<?php the_content() ?>
</div>

And I want something like:

<div class="post">
<meta itemprop="articleBody" content="<?php the_content() ?>">
</div>

But that removes images from the content, and appends ">.. So I'm aware I'm not closing it properly. But how do I "make the PHP stop", and be contained within the content="" tags?

Thanks,


Solution

  • Ah, I got it!

    Sort of. I just approached it wrong (to be fair, I was mislead by by the recommendation in Google's WMT), for anyone else:

    The tag should be inside the div container, not meta at all (that came from WMT):

    <div itemprop="articleBody" class="post">
         <?php the_content() ?> 
    </div>