【发布时间】:2015-11-14 19:50:08
【问题描述】:
在我的新网站 (http://tinyurl.com/q53ccn8) 的主页上,我在新闻滑块下显示最近的帖子(标题 = Nieuws)。
我用下面的代码来做这个:
<?php $args = array( 'numberposts' => '5', 'offset' => 6,); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<li class="list-group-item"><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a> </li> ';}?>
现在,我想在 40 个字符(包括空格)之后用 ... 删减最近帖子的标题,以便每个标题都固定在一行上。我如何在上面使用的代码中做到这一点?
提前致谢。
【问题讨论】: