[wp-hackers] parent page excerpt??
Simon Blackbourn
piemanek at gmail.com
Thu Jul 7 09:53:41 UTC 2011
> I'm wanting to show the title and excerpt of a parent page (i've enabled
> excerpts for pages) when visiting a child page. If not a child, show the
> normal excerpt and title. TItle works but excerpt won't on the child pages.
> Here's simplified code:
>
> http://www.pastie.org/2176199
>
>
get_the_excerpt doesn't take any parameters, it can only be used within the
loop [1].
echo $parent->post_excerpt will return the excerpt of your parent post.
i'm not at my PC at the moment so not sure if that applies the correct
filters or not, so you might need to do:
echo apply_filters( 'the_excerpt', $parent->post_excerpt )
[1] http://codex.wordpress.org/Function_Reference/get_the_excerpt
More information about the wp-hackers
mailing list