WordPress.org

Forums

How to get page title and exercpt (1 post)

  1. skeeterz71
    Member
    Posted 1 year 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;
     ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.