我正在寻找一种过滤\\u内容的干净方法,以便在每个H1标记之前添加一段代码。事实上,我有一个很长的隐私政策文本,我想在每个段落之前添加一个返回顶部的链接。当然,我可以轻松地在内容编辑器中添加这些内容,但我不希望我的客户能够意外地将其删除。
所以我有这样的想法:
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
我想过滤它以获得:<a href="#">Back to the top</a>
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
<a href="#">Back to the top</a>
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
<a href="#">Back to the top</a>
<h1>BLA BLA BLA</h1>
<p>A very interesting piece of text here...<p>
提前感谢您的时间。干杯
J