WordPress.org

Ready to get started?Download WordPress

Forums

get_posts not respecting the more attributes (3 posts)

  1. chrisj
    Member
    Posted 8 years ago #

    Hi I am retrieving a list of posts using the following code:

    <?php
    $posts = get_posts('category=12');
    foreach($posts as $post) :
    setup_postdata($post);
    ?>
    <?php the_content(); ?>
    <?php endforeach; ?>

    But instaed of only showing content up to the more quicktag it shows the whole page.

    Any ideas why this is?

  2. silpstream
    Member
    Posted 8 years ago #

    What sort of page is this? Index? Archive? Page? Post? Category? The codex states:

    If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages.

    You may want to try the_excerpt() instead.

  3. chrisj
    Member
    Posted 8 years ago #

    Cheers, but the excerpt returns a fixed number of characters, I need the specific text that appears before the more quick tag.

    It's a temmplate associated to a specific page that is returning the posts from a specific category. So I'd like to see the text above the more quick tag for all of the posts within that category.

    Does this make sense?

Topic Closed

This topic has been closed to new replies.

About this Topic