• Hi Folks,

    I’m trying to display snippets of pages on my homepage using the code below, but it doesnt display anything, can anyone please help?

    function robins_get_the_excerpt($post_id) {
      global $post;
      $save_post = $post;
      $post = get_post($post_id);
      $output = get_the_excerpt();
      $post = $save_post;
      return $output;
    }
    
    <?php
    echo robins_get_the_excerpt('14'); ?>
Viewing 1 replies (of 1 total)
  • Thread Starter matthisco

    (@matthisco)

    I’m trying this code now but it doesn;t work either, nothing shows up.

    <?php
    // retrieve one post with an ID of 5
    query_posts( 'p=2' );
    
    // set $more to 0 in order to only get the first part of the post
    global $more;
    $more = 0;
    
    // the Loop
    while (have_posts()) : the_post();
    echo the_content( 'Read the full post ?' );
    endwhile;
    ?>

    Anyone?

Viewing 1 replies (of 1 total)
  • The topic ‘Display snippets of pages on homepage’ is closed to new replies.