我的wordpress主题目前在摘录的末尾添加了“...”。要阅读整篇文章,您必须点击精选图片或帖子标题。需要帮助修改摘录代码
我想用“......阅读更多”替换“...”,并且喜欢这篇文章。
我的博客位于@ www.cur-mudg-eon.com,如果您需要了解它是如何设置的。
theme-function.php中的代码全部位于pastebin。
这里的代码位,我认为需要改变:
<?php
// The excerpt based on words
function my_string_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words).'...';
}
// The excerpt based on character
function my_string_limit_char($excerpt, $substr=0)
{
$string = strip_tags(str_replace('...', '...', $excerpt));
if ($substr>0) {
$string = substr($string, 0, $substr);
}
return $string;
}
如果需要更多的信息/代码回答我的问题让我知道。
感谢
谢谢Obmerk。我是否使用此代码替换我提供的代码的一部分,或者只是将它添加到现有代码中? – BryGuy
把它放在你的function.php文件中 –
当我将代码添加到“function.php”文件时,它会导致以下错误:“内部服务器错误 服务器遇到内部错误或配置错误,无法完成请求。 “ – BryGuy