I’m using the options framework
and i can’t work out why this doesnt work
$x = of_get_option('post_number');
$content_post = get_post($x);
echo $content_post->post_excerpt;
its very odd because
echo of_get_option('post_number');
works perfectly and outputs a number
and according to get_post my code should work
yet the echo produces nothing, not even an error message
so i must be handeling get_post() incorrectly somehow, any clues?
EDIT
var dump http://pastebin.com/ZEgQ5WPn
reveals that post_content is full but post_excerpt is empty
how do i regenerate the excerpt?
EDIT [resolved]
i decided to manualy overwrite the excerpt but my option was missing, then i found this
and used
add_post_type_support( 'page', 'excerpt' );
to manualy write the excerpt
This will take the post_content and create an excerpt out of it. You can substitute the post_content for any other string of code. Change the 55 to another number to increase the amount of words returned.
You should be able to use get_post() like this, which returns almost all built-in post attributes as part of the post object.
If that fails (it shouldn’t, but perhaps you’ve tried by the sound of it) maybe checkout out WP_Query and pass in
"p=$my_id"
as a param. This is likely the function used under the get_post hood anyways.