post_excerpt instead of post_content, outside of the loop

admin

Administrator
Staff member
I'm trying to get a wordpress excerpt from a page to appear in a styled area of my footer. I currently have the following, which gives me the title and all of the content:

Code:
<?php
$page_id = 2;
$page_data = get_page( $page_id );
$content = $page_data->post_content;
$title = $page_data->post_title;
echo '<h3>'. $page_data->post_title .'</h3>';
echo '<p>'. $page_data->post_content .'</p>'; ?>

I've tried various combinations of post_excerpt instead of post_content, and have tried emulating and editing the example here: <a href="http://codex.wordpress.org/Function_Reference/get_page" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_page</a> but am not having any luck. A few times I've tried examples from other people, but there has been no content at all.

Could this be because I'm trying to get it to display outside of the loop, or have I just not hit the right combination yet?

Thanks.