Support » Fixing WordPress » Page Excerpt Outside the Loop

  • rize


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

Viewing 2 replies - 1 through 2 (of 2 total)
  • steverobertsco


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



    Thanks but that doesn’t work.

    Anyone can help with this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page Excerpt Outside the Loop’ is closed to new replies.