/ Published in: PHP
This gets the content from the page with the ID 22 (change as appropriate on line 1) and echos the first 20 words (change word count on line 8) - can be used on any page inside your Wordpress theme.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?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); $i = 0; while ($i <= 20) { $short .= $words[$i] . ' '; $i++; } echo $short; ?>