php - 如何将按钮文本从阅读更多更改为帖子类别和 wordpress 中的其他文本?
问题描述
如何更改阅读更多帖子类别中的帖子链接文本?另外如何更改相关的帖子文本还有它的阅读更多按钮 发布图片供参考
我尝试在 post-single.php 和 funtions.php 中添加代码
// Customizes read more link in excerpts
function new_excerpt_more($more) {
global $post;
return ‘ <strong> … on the edge of your seat? Read more! </strong> ‘; //you
can change this text to whatever you like
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);
解决方案
根据您所显示的内容,您的片段将适用于默认阅读更多内容,在法典中显示为经典。
看看您的代码片段如何没有显示在按钮上的任何位置?
让我们试试这个。
function new_excerpt_more($more) {
global $post;
return ' <a class="moretag btn btn-primary" href="'. get_permalink($post->ID) . '">Read More »</a>'; //Change to suit your needs
}
add_filter( 'excerpt_more', 'new_excerpt_more' );
这至少应该将您带到可以调试的地步,但请注意,它可能是非常特定于主题的。一个 URL,如果你能提供它可以提供很多帮助。
推荐阅读
- cmake - 带有 FATAL_ERROR 的 CMake 多行消息
- vba - VBA Excel 2011:编译错误:找不到方法或数据成员 - 简单形式
- sql - 如果使用案例,在 bigquery 中获取两行输出
- knockout.js - 如何混合可观察和计算的淘汰赛
- android - 如何为菜单项设置自定义字体?
- java - 如何从 selenium java 中的 multi_select 中的列表中选择一个项目
- android - Android kotlin mockMaker 问题
- amazon-web-services - 验证通过 Storage Gateway 上传到 S3 的文件
- php - 检查数组中的值是否在其他数组中
- c# - 如何将键和值与字典对象分开