So my problem is – I’ve div with this kind of structure:
<div>
<strong> Value 1</strong>
<strong> Value 2</strong>
<strong> Value 3</strong>
</div>
It’s a wordpress site, I’ve posts with slugs like – /value-1/ /value-2/ etc.
I need to use this wp function – wp_some_function(get_ID_by_slug(‘any-page’)); and add attribute to each of those strong tags with that post id. So it would look like:
<div>
<strong id="2334"> Value 1</strong>
<strong id="34322"> Value 2</strong>
<strong id="2323"> Value 3</strong>
</div>
So basically I need to get content of each , replace spaces with dash, and add it in function I wrote above to get page ID, which I need to add as “id” attribute”.
Try this or drive your code from it