Forums

[resolved] "Read More" tag won't work when using query_posts (3 posts)

  1. bgentry
    Member
    Posted 1 year ago #

    I'm building a custom theme that has for a home page a static page that includes some static information and also shows the latest post. Here's the code I'm using to grab and display the latest post:

    <?php query_posts('showposts=1'); ?>
        <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    <?php the_content('Read more...'); ?>
        <?php endwhile;?>

    It works, but it displays the entire post rather than stopping at the <!--more--> tag and displaying a "read more" link. This forum post says that query_posts stops the pagination features and that the solution is found in this other post, but the other post does not make it clear how to solve this problem. Any suggestions for what code to change?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  3. bgentry
    Member
    Posted 1 year ago #

    That was it. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic