WordPress.org

Forums

how to display teaser only? (7 posts)

  1. jodeci
    Member
    Posted 9 years ago #

    Normally I like to go through the documents before asking, but somehow my ISP cannot access the codex support site, so please bear with me if I'm asking the obvious.

    Here is the code I'm using on the sidebar template:


    '<?php'
    '$my_posts = get_posts('category=2&numberposts=1&offset=0');'
    'foreach ($my_posts as $post) :'
    'start_wp();'
    '?>'
    '

  2. '
    '<h2>Current Issue: <?php the_title() ?></h2>'
    '<?php the_content('more »'); ?>'
    '
  3. '
    '<?php'
    'endforeach;'
    '?>'

    This does exactly what I want on the index page. However, the sidebar displays the full text instead of the teaser on the single pages. How should I code the sidebar to only display the teaser (plus a more link) on the single pages as well? Site in question:

    http://www.jds-online.com/

    Thanks.

  • moshu
    Member
    Posted 9 years ago #

    Replace the_content with the_excerpt.

  • jodeci
    Member
    Posted 9 years ago #

    Umm, that is nonetheless an option, but is it not possible to just display the teaser part of the_content?

  • moshu
    Member
    Posted 9 years ago #

    Define "teaser".

  • jodeci
    Member
    Posted 9 years ago #

    I was under the impression that "teaser" was a WP term. There *is* a 'strip_teaser' paramter after all, am I not correct? Then again...

    Everything before the <!--more--> tag, including text and markup.

  • jodeci
    Member
    Posted 9 years ago #

    bump? :)

  • Beel
    Member
    Posted 9 years ago #

    Might want to get a plugin to list recent posts in the sidebar.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags