<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>
Run Code Online (Sandbox Code Playgroud)
这里echo substr($content,0,100);不能裁剪从0到100的内容.这位于my_theme/functions/widgets/widget-portfolio-posts-thumbs.php
小智 19
试试这个:
$content = get_the_content();
$content = strip_tags($content);
echo substr($content, 0, 100);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12971 次 |
| 最近记录: |