删除继续阅读 - >来自聚合网站的帖子

时间:2013-05-23 15:00:10

标签: php wordpress

我正在使用FeedWordPress插件来汇总其他博客的帖子。我正在使用杂志基本主题。

有些帖子构成了其他博客,通常来自Twenty Eleven WP主题,有一个"继续阅读 - >"在除了"阅读更多 - >"之外的节选结尾。内置杂志基本主题。

我想删除"继续阅读 - >"登录页面上所有摘录的按钮。

我注意到"继续阅读 - >"显示在Feed(see here)中的博客最终会显示"继续阅读 - >"按钮,而不是那些(例如,here)显示"继续阅读 - >"只是在同一个地方[...],这很好。

我猜我可以删除"继续阅读 - >"按钮使用某种正则表达式,但在主题模板中这是完成的?也许在index.php文件中?因为我正在聚合,所以我显然无法编辑帖子正在编写的主题。

3 个答案:

答案 0 :(得分:1)

将以下内容添加到主题的style.css中。如果您无权访问FTP中的主题文件,您应该可以直接从WordPress后端进行编辑。

.home article  p > a {display:none;} // to hide the continue reading link
.home article  p > a.more-link {display:inline;} // to display the read more button

只要文本摘录中没有链接,这将有效。请注意,我的目标是“主页”类,因此这只会影响主页。

如果您能够将类附加到继续阅读链接,您可以只定位该类并避免从摘录中删除链接,但听起来您不能访问这些文件。

另一种方法是使用像这样的小jQuery:

<script>$("a:contains('Continue Reading')").css("display", "none");</script>

这只会定位链接中包含“继续阅读”的字样,以便对您有所帮助。

如果有帮助,请告诉我。

答案 1 :(得分:0)

  

在function.php中替换两个此功能并生成您的Feed。

function twentyeleven_continue_reading_link() {
    return ' <a href="'. esc_url( get_permalink() ) . '">' . __( '[...]', 'twentyeleven' ) . '</a>';
}
endif;

function twentyeleven_auto_excerpt_more( $more ) {
    return '' . twentyeleven_continue_reading_link();
}
add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );

enter image description here

答案 2 :(得分:0)

我尝试了许多方法仍然无法正常工作,但临时你可以使用手册,在解析成html时更新你的css文件:

.link-more {
   display:none;
}
相关问题