ใช้ plugin ตัวนี้ ติ๊กค่าไม่ให้มันโชว์หน้าแรก
http://wordpress.org/extend/pl...gins/wp-hide-post/screenshots/ อ้อ....ผมเข้าใจผิดนึกว่าไม่ให้แสดงที่หน้าแรก
ไฟล์ functions.php เพิ่มโค้ดเหล่านี้ลงไป
function string_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
หน้า index.php แทีกโค้ดนี้ลงไป
<?php get_the_content_limit(150,''); ?>