我有一个HTML模板,我将其转换为Wordpress主题,但我无法将“阅读更多”按钮添加到主页。
我在函数中使用以下代码。php:
function the_content_limit($max_char, $more_link_text = \'(more...)\', $stripteaser = 0, $more_file = \'\') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters(\'the_content\', $content);
$content = str_replace(\']]>\', \']]>\', $content);
$content = strip_tags($content);
if (strlen($_GET[\'p\']) > 0) {
echo "<p>";
echo $content;
echo "</p>";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
echo "<p>";
echo $content;
echo "...";
echo "</p>";
}
else {
echo "<p>";
echo $content;
echo "</p>";
}
}
我还在索引中使用以下代码。php:
<div class="text_home"><?php the_content_limit(300); ?></div>
我能做些什么来解决我的问题?