ได้แล้วครับ ผมเข้าไปเพิ่มcodeที่ functions.php ใน theme ที่ใช้อยู่
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;
}
แล้วก้อนำcodeนี้
<?php echo excerpt(40); ?>
ไปใส่ในหน้า index.php หรือหน้า archive.php หรือหน้า category.php และตำแหน่งที่ต้องการแสดงผลตามต้องการเลยครับ
และถ้าต้องการให้มันตัดคำยาวขึ้นหรือสั้นลงเปลี่ยนค่าที่ 40 จะมากหรือน้อยแล้วแต่ตามสะดวกครับ
ส่วนผมลองทำที่หน้าadmin แล้วไม่ได้ผล ตามวิธีที่เพื่อนสมาชิกแนะนำ ขอขอบคุณทุกๆๆคนครับ