需要一点帮助,这是一个返回文本内容并在wordpress中读取更多链接的函数:
function whisper_entry_contentoffer1()
{
global $whisper;
// Check on singular pages
$is_single = is_singular() && !is_page_template( 'tpl/blog.php' ) && !is_page_template( 'tpl/blog-boxes.php' );
// Allow to config via global variable
if ( isset( $whisper['is_single'] ) )
$is_single = $whisper['is_single'];
if ( $is_single )
{
echo '<div class="entry-content">';
the_content();
wp_link_pages( array(
'before' => '<p class="pages">' . __( 'Pages:', 'whisper' ),
'after' => '</p>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
echo '</div>';
return;
}
// Archives & Blog pages
// Display type
$display = fitwp_option( 'blog_display' );
// Allow to config via global variable
if ( isset( $whisper['blog_display'] ) )
$display = $whisper['blog_display'];
if ( !$display )
$display = 'content';
echo '<div class="entry-summary">';
// Excerpt
if ( 'excerpt' == $display )
{
the_excerpt();
return;
}
$more_text = whisper_more_text2();
// Post content before more tag
if ( 'more' == $display )
{
if ( is_page_template( 'tpl/blog.php' ) || is_page_template( 'tpl/blog-boxes.php' ) )
{
global $more;
$more = false;
}
the_content( $more_text );
wp_link_pages( array(
'before' => '<p class="pages">' . __( 'Pages:', 'whisper' ),
'after' => '</p>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
}
else
{
whisper_content_limitoffer1( whisper_content_length(), $more_text );
}
echo '</div>'; // .entry-summary
}
现在我需要将输出文本限制为12个字。任何建议或灵魂?!
...谢谢
答案 0 :(得分:0)
此?用字符串
替换$ stringecho implode(" ",array_splice(explode(" ",$string),0,20));