2012-12-23 171 views
0

我們可以在wordpress單頁中隱藏我們的全部內容嗎?僅顯示內容帖子評論者

通常;我想爲所有用戶提供一些文字,而不是我的single.php上的完整文章 像;

如果你閱讀整篇文章請寫下您的意見:)

如果用戶評論過的我希望顯示全員額,評論者是可以不?

任何幫助的感謝

簡單的single.php

<?php get_header();?> 

<?php the_post(); ?> 
<?php the_title(); ?> 
<?php the_content(); ?> 
<?php comments_template(); ?> 

<?php get_footer();?> 
+0

感謝編輯我的語法錯誤,沃爾特斯 –

+0

¿什麼是單頁代碼?例如,其常規代碼爲 –

+0

。 '<?php the_content(); ?>' –

回答

0

你可以做這樣的事情:

<?php 
// Instead of function the_content() 
$Content = get_the_content(); 
echo string_limit_words($Content, 15) . " ..."; //Where 15 is the number of words you want to display 

// Place this function in "functions.php" in the style sheet directory 
    if (!function_exists('string_limit_words')) { 
    function string_limit_words($string, $word_limit) { 
     $words = explode(' ', $string, ($word_limit + 1)); 
     if (count($words) > $word_limit) array_pop($words); 
     return implode(' ', $words); 
    } 
    } 
?> 
+0

Felipe A.謝謝,但我們如何控制用戶是否評論? –