Support » Fixing WordPress » more tag not working

  • Resolved greencode

    (@greencode)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘more tag not working’ is closed to new replies.