Php 如何在post类别和post wordpress中将按钮文本从read more更改为其他文本?
如何更改“阅读更多”的帖子类别中的帖子链接文本? 另外,如何更改相关帖子及其“阅读更多”按钮 我尝试在post-single.php和funtions.php中添加代码Php 如何在post类别和post wordpress中将按钮文本从read more更改为其他文本?,php,wordpress,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! <
// 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’);
//自定义摘录中的阅读更多链接
函数新摘录更多($更多){
全球$员额;
返回“…在您的座位边缘?阅读更多!”;//您
您可以将此文本更改为任何您喜欢的内容
}
添加过滤器(“摘录更多”、“新摘录更多”);
根据您正在显示的内容,您的代码片段将适用于默认的read more,在codex中显示为Classic
查看您的代码片段如何不显示在按钮上的任何位置
让我们试试这个
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' );
函数新建\u摘录\u更多($更多){
全球$员额;
返回“”;//更改以满足您的需要
}
添加_过滤器('extract_more','new_extract_more');
这至少会使您达到可以调试的程度,但需要注意的是,它可能非常特定于主题。一个URL,如果你能提供的话,可以帮上大忙。我应该在functions.php中添加这个片段吗?