Forums

[resolved] use page experts individually (4 posts)

  1. 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

  2. esmi
    Theme Diva & Forum Moderator
    Posted 10 months ago #

  3. jomsky
    Member
    Posted 10 months ago #

    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;
    ?>
  4. geoffmuskett
    Member
    Posted 10 months ago #

    Brilliant! Thank you! So simple and works great

Reply

You must log in to post.

About this Topic

Tags