geoffmuskett
Member
Posted 10 months ago #
Hi, how would I go about grabbing a page experpt and display it individually on another page? Or perhaps targeting it in the database to display it individually?
I've searched round but found no answer yet...
I have this add_post_type_support( 'page', 'excerpt' ); in my functions to allow pages to have exerpts.
Thanks
I thought get_the_excerpt() would help you with that but upon checking the codex it no longer supports the post ID parameter (?).
Or something like this for a single post:
To get the excerpt for a post with ID 7:
<?php
$my_id = 7;
$post_id_7 = get_post($my_id);
$title = $post_id_7->post_excerpt;
?>
geoffmuskett
Member
Posted 10 months ago #
Brilliant! Thank you! So simple and works great