• I’m using the “get-posts” code to place excerpts from previous posts at the bottom of my page. Here is the code:
    <?php
    $posts = get_posts('offset=3');
    foreach ($posts as $post) :
    ?>

    • "><?php the_title() ?> --- <?php the_excerpt() ?>
    • <div class="meta">Posted on <?php the_time('F jS Y @ g:ia',display); ?>&nbsp;<?php _e("Then stored in:"); ?>&nbsp;<?php the_category() ?></div>
      <?php
      endforeach;
      ?>
      I want to do two things:
      1. I want to shorten the excerpt that appears on the page to just a few lines. Can anyone tell me how to change this code to do that?
      2. I want to include “comments” so that readers can see if there were comments to the post. Everything I’ve read about “comments” says the code has to be INSIDE the LOOP but the above code has to be OUTSIDE the LOOP. Any ideas on how I can add this?
      TIA…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jabbok

    (@jabbok)

    Oh… I see.
    I had problems getting this to work and someone told me to place this section of code “Outside the Loop”. I thought there was only one loop!
    I’ll piddle with the comment section then and try to get it going. That only leaves question #1.
    Thanks…

    There another excerpt function where you you could specify the length
    <?php the_excerpt_rss(100); ?>

    Thread Starter Jabbok

    (@jabbok)

    I tried the function you mentioned. It did shorten the excerpt but the rss included html functions that I used in the original post and made the excerpt look jumbled.
    I did read further (Shock & Awe) and learned that this is what the “Excerpt” section is actually for. I edited the posts and did a cut and paste and now just a small excerpt shows up under “Additional Reading” at the bottom of my blog. This is what I wanted but it leads me to another question.
    I thought the “Excerpt” block was for lengthy posts. You could show an excerpt and then have a “Continue Reading” link at the bottom to read the full post. This doesn’t seem to be the function. Or is it because I’ve used the offset that the excerpt only appears at the bottom?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Get Posts’ is closed to new replies.