Support » Fixing WordPress » Read More Link Question

  • Greetings,

    I am having an issue with the “read more” jump link. It works just fine on my blog page, but on another page of the site I’m also displaying the latest 5 posts. On that 2nd page, all the posts show, but the “read more” link doesn’t. How do I correct this?

    Here is the php code that I use on that 2nd page:

    <?php
    require_once('wp-config.php');
    wp('feed=rss');
    start_wp();
    if (have_posts()) : ?>
      <?php query_posts('showposts=5'); ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    				<small><!-- by <?php the_author() ?> --> by <a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><br /><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p></small>
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    			</div>
    	<?php endwhile; ?>
    
    <?php endif; ?>

    Thank you!

Viewing 1 replies (of 1 total)
  • I had this same problem, and I only found it after much searching and digging around. Surprisingly – or not so, depending on how you look at it – I found the answer here on the query_posts page http://codex.wordpress.org/Template_Tags/query_posts

    If you want to use the Read More functionality with this query, you will need to set the global $more variable to 0.

    If you want to use the Read More functionality with this query, you will need to set the global $more variable to 0.
    
    <?php
    // retrieve one post with an ID of 5
    query_posts('p=5');
    
    global $more;
    // set $more to 0 in order to only get the first part of the post
    $more = 0; 
    
    // the Loop
    while (have_posts()) : the_post();
      // the content of the post
      the_content('Read the full post »');
    endwhile;
    ?>

    Hopefully that helps you and anyone else who comes looking for this answer.

Viewing 1 replies (of 1 total)
  • The topic ‘Read More Link Question’ is closed to new replies.