0

在我的 WordPress 安装中,我试图在主页上显示一个简短的帖子文本摘要(请参阅以红色突出显示的附加图像和文本)

主页包含我最近的帖子(默认帖子)的堆叠列表。

我已经知道的两种常见解决方案:

解决方案#1 - “插入更多”标签:- 我不想有一个“更多”按钮。我只需要有特色图片、作者​​、类别,然后是缩短的帖子摘要。

解决方案 #2 - 将“the_content”替换为“the_excerpt”——我在 index.php 和 archive.php 中查找了“the_content”,但这些文件中似乎不存在。它存在于 blog.php 中,但将其更改为“the_excerpt”没有任何作用,并且在创建帖子时没有摘录选项。

我的 WP 主题是Qreator 响应式 WP

提前感谢您的帮助!

4

1 回答 1

1
<?php   
  add_filter("the_content", "plugin_myContentFilter");

  function plugin_myContentFilter($content)
  {
    // Take the existing content and return a subset of it
    return substr($content, 0, 300);
  }
?>

看这里

于 2013-08-27T09:51:47.703 回答