在wordpress中,我有一个loop.php文件。在那里我可以看到“阅读更多”的代码。我更改了它,它确实在首页上生效。但是如果我打开标签页面,我得到的是旧的“继续阅读”文本,而不是来自loop.php的“阅读更多”的编辑文本
这是我在loop.php上的资料
<div class="entry-content">
<?php the_content( __( '<span class="read_more">Read More</span>', 'boilerplate' ) ); ?>
</div><!-- .entry-content -->这就是我在tag.php上使用的
get_template_part( 'loop', 'tag' );但正如我所说的,我没有得到“阅读更多”(就像我在首页上得到的那样),而是得到了“继续阅读”。
我已经查看了general-template.php和functions.php,没有任何迹象表明它与read more代码相关。我在google上所做的一切研究都只是在编辑loop.php文件,或者对一个新的loop-tag.php文件进行镜像处理。我做到了,但结果是一样的:我得到的不是“阅读更多”,而是“继续阅读”。
谢谢你的帮忙
发布于 2012-04-05 09:55:44
这实际上取决于您的主题以及如何将loop.php实现到每个主题文件中。
但要获得更多帮助,请参阅http://codex.wordpress.org/Customizing_the_Read_More。
根据http://wordpress.org/support/topic/theme-boilerplate-excerpt-more-link-customization?replies=3的说法:
function volta_setup() {
remove_filter( 'get_the_excerpt', 'boilerplate_custom_excerpt_more' );
remove_filter( 'excerpt_more', 'boilerplate_auto_excerpt_more' );
}
add_action('after_setup_theme', 'volta_setup');发布于 2012-04-06 09:11:02
我以前曾与这种令人困惑的行为作过斗争。在编辑帖子时,使用<!--more-->标签与使用摘录字段时,Wordpress对待摘录的方式不同。
如果the_content()检测到<!--more-->标记,它只会在示例中包含使用"Read more“文本。
有关更多详细信息,请查看Codex。http://codex.wordpress.org/Customizing_the_Read_More
编辑:哇,@markratledge已经为你指明了正确的方向。
发布于 2017-04-20 18:12:48
这可能不是最佳实践,但在我的情况下,它解决了问题……
<script>
jQuery( document ).ready(function() {
jQuery(".read_more").text("Change me");
});
</script>Source -基于DIVI主题的阅读更多按钮
https://stackoverflow.com/questions/10020913
复制相似问题