Does the page have an excerpt entered into the excerpt field?
If there’s nothing in the excerpt field for that page, you’ll see just that, nothing!.. 🙂
You could use something like this instead..
<?php global $post; $myposts = get_posts('post_type=page&include=424'); ?>
<?php foreach( $myposts as $post ) : setup_postdata( $post ); ?>
<?php the_excerpt(); ?>
<?php endforeach; wp_reset_query(); ?>
http://codex.wordpress.org/Template_Tags/get_posts
Using get_posts() and setup_postdata() should allow the use of the_excerpt() which will return content even if you’ve not used the excerpt field.. 😉
NOTE: Despite the name, get_posts() can return any post_type, not just posts.. (and it supports more parameters then the get_page eqivalent).
yes i create an excerpt field with some word but nothing, your code is perfect, now I have to add the possibility to have random subpage of a page.
I don’t know that get_post return also page, i think that return only posts, thank you very much!
excuse me for my bad english 🙂
kikko088
now i put on the code the parent and random,but i have only a question, to have the link to complete post instead the “[…]” what I have to do?
thank you very much.
kikko088
add this code in your functions.php
add_filter('wp_trim_excerpt', custom_excerpt);
function custom_excerpt($text) {
$text = str_replace('[...]', '<a href="' . get_permalink() .'">..complete post</a>', $text);
return $text;
}
In WP 2.9+ you can use excerpt_more instead of wp_trim_excerpt:
add_filter('excerpt_more', 'custom_excerpt');
function custom_excerpt($custom) {
return '<a href="' . get_permalink() .'">..complete post</a>';
}