WordPress.org

Ready to get started?Download WordPress

Forums

Retrieve excerpt from a page (1 post)

  1. gashface
    Member
    Posted 2 years ago #

    Hi there, I am trying to create a loop that loads a random image from any posts, whilst also retrieving the excerpt of a specific page. I have done the random post part, but cannot get it to retrieve the page excerpt. I have installed the function to get page excerpt support etc. but I think I am doing something wrong within the loop, any help would be appreciated.

    <div class="postimage">
    <?php if (have_posts()) :
    query_posts('showposts=1&orderby=rand');
    while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('blog-post-image'); ?></a>
      <div class="borderimage"></div>
      <div class="tagline"><h1><?php the_excerpt('$page_id=8'); ?> </h1>
    </div>
      </div>
    </div>
    <?php endwhile; else : endif; ?>

    [No bumping, please.]

Topic Closed

This topic has been closed to new replies.

About this Topic