WordPress.org

Ready to get started?Download WordPress

Forums

Showing single most recent post excerpt (2 posts)

  1. whooven
    Member
    Posted 8 years ago #

    I've been searching for hours now with no luck so I'd thought I'd post this as a question.

    1) Is there a way for me to show an excerpt of the single most recent post on a WP page? When you click the page, I only want it to show an excerpt of the most recent post.

    2) Is there a way to limit the number of characters shown in the excerpt mentioned in #1?

    I saw this in the tonus theme in the sidebar code and wonder if I can adapt it for the page code.

    ------------------

    <h2><?php _e('recent posts'); ?></h2>

    ------------------

    Much thanks for any help or suggestions offered.

  2. TonyGeer
    Member
    Posted 8 years ago #

    Check the codex for the usage of query_posts, what you'll have to do is something similar to this:

    Use query_post with showpost=1, then run The Loop and instead of displaying "the_content" display "the_excerpt". The_excerpt is a fixed amount set in wordpress, I think the first 200 characters.

Topic Closed

This topic has been closed to new replies.

About this Topic