Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.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

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
Php 限制头版文章的字数(在WP 3.0上)?_Php_Wordpress_Plugins - Fatal编程技术网

Php 限制头版文章的字数(在WP 3.0上)?

Php 限制头版文章的字数(在WP 3.0上)?,php,wordpress,plugins,Php,Wordpress,Plugins,我都 我有一个不同长度的文章博客,我希望主页只显示文章的前100个单词。 之后,应(自动)添加“更多” 使用WP 3.0执行此操作的好方法是什么 (我找到了“内容和摘录字数限制”插件: 但是: 我看到它适用于WP 3.0,但也不能 由于twenty-ten主题有点复杂,我应该以什么方式将其添加到主题中?(添加一个名为loop-index.php的文件并在那里进行更改?) 在WordPress主题的index.php开头定义类似的内容,其中$s是字符串,$l是所需的字数: function cu

我都

我有一个不同长度的文章博客,我希望主页只显示文章的前100个单词。 之后,应(自动)添加“更多”

使用WP 3.0执行此操作的好方法是什么

(我找到了“内容和摘录字数限制”插件:

但是:

  • 我看到它适用于WP 3.0,但也不能

  • 由于twenty-ten主题有点复杂,我应该以什么方式将其添加到主题中?(添加一个名为loop-index.php的文件并在那里进行更改?)


  • 在WordPress主题的index.php开头定义类似的内容,其中
    $s
    是字符串,
    $l
    是所需的字数:

    function cut($s, $l) { 
      if($l<strlen($s)){
        while ($string{$l--} != " ");
        return substr($s, 0, $l+1); 
      } else return $string; 
    }
    
    函数削减($s,$l){
    
    如果($lh)这将如何处理格式化?假设它正好在标记关闭之前-它会导致问题吗?