I have this code:
<p>
<iframe src=""></iframe>
</p>
How can I add a class to the P using function.php? only in a single post?
so the result will be:
<p class="something">
<iframe src=""></iframe>
</p>
I have this code:
<p>
<iframe src=""></iframe>
</p>
How can I add a class to the P using function.php? only in a single post?
so the result will be:
<p class="something">
<iframe src=""></iframe>
</p>
2
Answers
Since you haven’t given us much of an explanation of where your HTML is coming, I’ll just have to guess at a bunch of things. The code below will output the requested HTML on a single post.
Check if your p tag has children using jQuery: