现在,我在侧边栏中使用以下代码,它从名为“People”的分类法中获取与帖子相关的第一个术语,并将其与链接和描述一起显示。
<?php $taxonomy = \'peoples\';$terms = get_the_terms( $post->ID , \'peoples\' ); if ( !empty( $terms ) ) : foreach ( $terms as $term ) {if($counter++ >= 1) break; $link = get_term_link( $term, $taxonomy ); if ( !is_wp_error( $link ) ) echo \'<h2>Profile: \' . $term->name . \'</h2><ul id="profile"><li class="big-listing \' . $term->slug. \'"><div class="text">\' .$term->description.\'</div></li></ul>\';} endif;?>
问题是,我的描述通常超过400字,所以我需要弄清楚如何将其长度限制在40字以内。三个月来,我一直在寻找答案,哈哈;但我一点运气都没有。是否有人拥有可以处理此问题的功能?
谢谢