WordPress.org

Ready to get started?Download WordPress

Forums

How to get page title and exercpt (1 post)

  1. skeeterz71
    Member
    Posted 4 months ago #

    Hi,

    I found this code snippet that displays the entire content of the page. What I need is just the page title and an excerpt. What changes do I need to make? Thanks

    <?php
     $page_id = 38;
     $page_data = get_page( $page_id );
     $content = $page_data->post_content;
     $title = $page_data->post_title;
     echo $page_data->post_title;
     echo $page_data->post_content;
     ?>

Reply

You must log in to post.

About this Topic

Tags

No tags yet.