The following snippet will let you echo starting 20 words of any page in WordPress.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php $my_id = 22; // change to relevant page ID $post_id_5369 = get_post($my_id); $content = $post_id_5369->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $words = explode(' ', $content); $i = 0; while ($i <= 20) { $short .= $words[$i] . ' '; $i++; } echo $short; ?> |