WordPress.org

Support

Support » How-To and Troubleshooting » get_posts not respecting the more attributes

get_posts not respecting the more attributes

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_posts not respecting the more attributes’ is closed to new replies.