首页 > 解决方案 > 如何修改继续阅读链接?

问题描述

如果您使用 DOM 在 HTML 中显示您的 RSS,您会在“继续阅读”内容的末尾找到永久链接()。你可以在这里查看我的提要

这是标签结束前的脚本

 <p class="link-more"><a href="https://www.eitren.com/blog/products/bagaimana-cara-page-halaman-link-website-di-halaman-pertama-google-search-engine/" class="more-link">Continue reading<span class="screen-reader-text"> "Bagaimana cara page/halaman/link website di halaman pertama Google Search Engine?"</span></a></p>]]></description>

我想修改链接,在链接末尾添加 /AMP/。所以它会变成“...google-search-engine/amp/”类...

标签: phpwordpressrssfeedxml.modify

解决方案


这取决于您的 RSS 提要设置显示的具体内容。有些显示完整的帖子,有些显示摘录。the_content_more_link在您的情况下,您可以使用钩子过滤此文本。

function wpse_send_to_amp() { return '继续阅读'; } add_filter('the_content_more_link', 'wpse_send_to_amp');


推荐阅读