WordPress.org

Forums

[resolved] more tag not working (3 posts)

  1. greencode
    Member
    Posted 4 years ago #

    I have the following in my template so that only the first part of the post displays i.e. the content before the more tag. But it doesn't work and displays all of the conten.

    <?php query_posts('cat=1&showposts=1');?>
    <?php while (have_posts()) : the_post(); ?>
    <div>
    <?php the_content('Read more...'); ?>
    </div>
    <?php endwhile;?>

    Whereas if I use this code it does work.

    <?php query_posts('cat=1&showposts=1');?>
    <?php while (have_posts()) : the_post(); ?>
    <div>
    <?php
    global $more;    // Declare global $more (before the loop).
    $more = 0;       // Set (inside the loop) to display content above the more tag.
    the_content("More...");
    ?>
    </div>
    <?php endwhile;?>

    Just can't figure out why the first one doesn't work.

  2. Michael
    Forum Moderator
    Posted 4 years ago #

  3. greencode
    Member
    Posted 4 years ago #

    Ah ha, thanks for the link

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.