substr()无法在wordpress小部件中修剪the_content()

<div class="wpex-recent-posts-content clr">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><p>
<?php
    $content = the_content();
    echo substr($content,0,100);
?>
</p>
</div>

这里echo substr($content,0,100);无法将内容从0裁剪到100。该位置位于my_theme/functions/widgets/widget-portfolio-posts-thumbs.php

丹尼

试试这个:

$content = get_the_content();
$content = strip_tags($content);
echo substr($content, 0, 100);

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Wordpress小部件中的Javascript

来自分类Dev

PHP WordPress the_content()

来自分类Dev

了解wordpress the_content

来自分类Dev

WordPress Elementor小部件不在列表中

来自分类Dev

在wordpress小部件中设置cookie

来自分类Dev

在WordPress网站中实施外部小部件

来自分类Dev

在 WordPress 小部件中显示帖子

来自分类Dev

在 WordPress 小部件中设置 foreach

来自分类Dev

从 WordPress 中的“the_content”功能中剪切文本

来自分类Dev

在模板页面的wordpress中从the_content中排除类

来自分类Dev

wordpress the_content()未在正确的div中显示

来自分类Dev

需要从the_content()获取所有<img>;在WordPress中?

来自分类Dev

wordpress the_content()未在正确的div中显示

来自分类Dev

从 the_content WordPress 中删除带有 ID 的 div

来自分类Dev

在 WordPress 中 the_content() 前后添加内联图标

来自分类Dev

Wordpress(创世纪)小部件列无法正确显示

来自分类Dev

Android小部件WRAP_CONTENT无法正常工作

来自分类Dev

在Wordpress中的footer.php中创建小部件

来自分类Dev

我可以在Container中溢出小部件以使其像修剪的一样吗?

来自分类Dev

如何在Wordpress中制作多选小部件?

来自分类Dev

Wordpress-标准小部件中的the_title()限制字符

来自分类Dev

在wordpress中添加我自己创建的小部件代码

来自分类Dev

WordPress:在主页面模板中添加小部件区域?

来自分类Dev

删除wordpress“最近评论”小部件中的内联样式

来自分类Dev

在Wordpress中创建自定义小部件

来自分类Dev

仅在Wordpress窗口小部件中显示即将发生的事件

来自分类Dev

将<span>添加到Wordpress中的小部件标题

来自分类Dev

如何使用Wordpress窗口小部件填充HTML中的空白

来自分类Dev

获取类别小部件的Wordpress侧栏中的类别链接

Related 相关文章

  1. 1

    Wordpress小部件中的Javascript

  2. 2

    PHP WordPress the_content()

  3. 3

    了解wordpress the_content

  4. 4

    WordPress Elementor小部件不在列表中

  5. 5

    在wordpress小部件中设置cookie

  6. 6

    在WordPress网站中实施外部小部件

  7. 7

    在 WordPress 小部件中显示帖子

  8. 8

    在 WordPress 小部件中设置 foreach

  9. 9

    从 WordPress 中的“the_content”功能中剪切文本

  10. 10

    在模板页面的wordpress中从the_content中排除类

  11. 11

    wordpress the_content()未在正确的div中显示

  12. 12

    需要从the_content()获取所有<img>;在WordPress中?

  13. 13

    wordpress the_content()未在正确的div中显示

  14. 14

    从 the_content WordPress 中删除带有 ID 的 div

  15. 15

    在 WordPress 中 the_content() 前后添加内联图标

  16. 16

    Wordpress(创世纪)小部件列无法正确显示

  17. 17

    Android小部件WRAP_CONTENT无法正常工作

  18. 18

    在Wordpress中的footer.php中创建小部件

  19. 19

    我可以在Container中溢出小部件以使其像修剪的一样吗?

  20. 20

    如何在Wordpress中制作多选小部件?

  21. 21

    Wordpress-标准小部件中的the_title()限制字符

  22. 22

    在wordpress中添加我自己创建的小部件代码

  23. 23

    WordPress:在主页面模板中添加小部件区域?

  24. 24

    删除wordpress“最近评论”小部件中的内联样式

  25. 25

    在Wordpress中创建自定义小部件

  26. 26

    仅在Wordpress窗口小部件中显示即将发生的事件

  27. 27

    将<span>添加到Wordpress中的小部件标题

  28. 28

    如何使用Wordpress窗口小部件填充HTML中的空白

  29. 29

    获取类别小部件的Wordpress侧栏中的类别链接

热门标签

归档