Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeremy Frimond
14,470 Pointsthe_exerpt() for custom post types?
I would like to use the_excerpt(); for the content area of a custom post type I have created on a site. currently I am using the_field( 'content' ); for the main page. I would like just an excerpt of the content to show before the person clicks into the single post page.
How do I do this for custom post types?
cheers
1 Answer
Chris Shaw
26,676 PointsHi Jeremy,
You can do this two ways.
- In your
register_post_type
function call add the keysupports
and set the value as an array and inside it addexerpt
as an string, or; - Use the
add_post_type_support
hook and set your post type to supportexerpt