I have the following code
<div class="content"></div>
<div class="content">
<h3 itemprop="name">Grab this text</h3><div itemprop="description">Grab this text too</div>
</div>
How can I grab both those text parts and place them inside variables? I'm working in WordPress, building a plugin. There are multiple itemprops on the page that I don't want, so I can't select just those.
I've tried
$name = $xpath->query( '//div[@class="content"]//h3[@itemprop="name"]' );
But that doesn't select the second part description and leaves me with an error when I try to echo it.
I think I might have to iterate through them after grabbing the main div, but I'm not sure how to do that, and I looked up a few other stacks that didn't help.
Thanks