【发布时间】:2025-12-06 13:20:04
【问题描述】:
我有以下问题 - 如何找到一个具有“test”类的 div 并添加“</div>”before 和“<div class="sth">”after .
更详细的例子:
<!-- The original code -->
<div class="parent">
...here we can have some more content...
<div class="test"></div>
</div>
<!-- The thing that I want to achieve -->
<div class="parent">
...here we can have some more content...
</div>
<div class="test"></div>
<div class="sth">
</div>
我尝试使用 javascript/jQuery 但没有成功,因为它是在 DOM 中生成的。 所以我决定在展示内容之前用一些可以处理的东西来做。
有什么想法可以做到吗?
(内容将由 Wordpress 帖子生成,如果对您有帮助的话……)
附言对不起我的英语不好
【问题讨论】:
-
如果它在 DOM 中生成,那么你希望它如何在 PHP 中再次呈现?!
标签: jquery html wordpress dom wordpress-theming