Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在wordpress中显示更多行-_摘录()_Wordpress - Fatal编程技术网

如何在wordpress中显示更多行-_摘录()

如何在wordpress中显示更多行-_摘录(),wordpress,Wordpress,海, 我正在用wordpress设计一个博客。当我通过_extract()显示主题时,我遇到了一个问题。它只显示3行,然后继续链接。但我希望每个帖子都会显示 带有6-10行和continue->link。如何增加行号。您需要在呼叫前为主题添加一个过滤器 在筛选器中,您可以指定要在“除”中输入多少单词(您只能指定单词,不能指定行) 例如: function my_excerpt_length($length) { return 120; } add_filter('excerpt_leng

海, 我正在用wordpress设计一个博客。当我通过_extract()显示主题时,我遇到了一个问题。它只显示3行,然后继续链接。但我希望每个帖子都会显示 带有6-10行和continue->link。如何增加行号。

您需要在呼叫前为主题添加一个过滤器

在筛选器中,您可以指定要在“除”中输入多少单词(您只能指定单词,不能指定行)

例如:

function my_excerpt_length($length) {
    return 120;
}
add_filter('excerpt_length', 'my_excerpt_length');

如果你真的想过滤一定数量的行,你可以调用并提取你想要的行数-但要确保过滤内容,以确保没有不需要的内容进入你的博客。

好的,好的。。在我的wp includes/formatting.php中,它们的“摘录长度”已为55。我将其更改为150。它仍然不起作用…检查下面给出的一些代码formatting.php.php函数wp_trim_extract($text){$raw_extract=$text;if('=$text){$text=get_the_content('');$text=strip_shortcode($text);$text=apply_filters('the_content',$text);$text=str_replace(']>,']>,']',$text);$text);$text=strip_标签($text)$extract_length=apply_filters('extract_length',55);还有一个问题是我必须添加my_extract_length($length){}@James,你真的不应该更改wp includes/formatting.php,因为这是基本wordpress安装的一部分。你可以更改你的主题-(你现在可能使用默认的主题)。在wordpress主题编辑器管理->设计->主题编辑器(或其他编辑器,如果您愿意)中,将上面的代码添加到一些大括号中,这将满足您的需要。