WordPress.org

Ready to get started?Download WordPress

Forums

Page Excerpt Outside the Loop (3 posts)

  1. rize
    Member
    Posted 2 years ago #

    I need to show various excerpt from specific pages..

    I found this code:

    function get_the_excerpt_here($post_id)
    {
      global $wpdb;
      $query = "SELECT post_excerpt FROM $wpdb->posts WHERE ID = $post_id LIMIT 1";
      $result = $wpdb->get_results($query, ARRAY_A);
      return $result[0]['post_excerpt'];
    }

    But I'm not sure how to use it.. I tried
    <?php echo get_the_excerpt_here(12); ?>

    but it doesn't work..

  2. steverobertsco
    Blocked
    Posted 2 years ago #

    Maybe try get_excerpt instead of get_the_excerpt_here.
    Im unsure but maybe have a go, see if it works.

  3. rize
    Member
    Posted 2 years ago #

    Thanks but that doesn't work.

    Anyone can help with this?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.