Support » Themes and Templates » Read more link does not show in posts

  • Hi everyone, I have created a custom Blog page by copying the index page and replacing some of the scripts. I have used the following code to display my posts in this custom Blog page. everything shows up nicely apart from the Read more link. The page displays the complete post content. The same code works on the index.php page without any issues!! any suggestions.

    <div id="content" class="narrowcolumn" role="main">
    	<?php $temp = $wp_query; ?>
    	<?php $wp_query = null; ?>
    	<?php $wp_query = new WP_Query('');
    	while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<div class="thumbnail">
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_url') ?>/images/<?php echo get_post_meta($post->ID, 'post-thumbnail', true); ?>" width="200" height="200" alt="Post Image" /></a>
    			</div><!-- thumbnail ends -->
    			<div class="entry">
    				<h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    				<small class="post-info"><strong>Posted: </strong><?php the_time('F jS, Y') ?> in <?php the_category(', ') ?> by <?php the_author() ?></small>
    				<div class="post-desc">
    					<?php the_content('Read more'); ?><span class="post-comments"><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?></span>
    				</div>
    			</div>
    		</div><!-- post ends -->
    	<?php endwhile; ?>
    	<div class="navigation">
    		<div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
    		<div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
    	</div>
    	<?php $wp_query = null; ?>
    	<?php $wp_query = $temp; ?>
    	</div><!-- content ends -->

    [signature moderated Please read the Forum Rules]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Just wondering, why is the comment part wrapped in spans?

    Gangleri,
    <span> is used to display a background image for the comments link. It acts like a button.

    Any ideas why the “Read more” won’t show in the post ?

    I resolved the issue by adding
    <?php global $more ?>
    and
    <?php $more = 0 ?>
    in the appropriate places, here is my code after the changes

    <div id="content" class="narrowcolumn" role="main">
    	<?php global $more; ?>
    	<?php $my_query = new WP_Query('showposts=10');
    	while ($my_query->have_posts()) : $my_query->the_post(); ?>
    	<?php $more = 0; ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<div class="thumbnail">
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo('template_url') ?>/images/<?php echo get_post_meta($post->ID, 'post-thumbnail', true); ?>" width="200" height="200" alt="Post Image" /></a>
    			</div><!-- thumbnail ends -->
    			<div class="entry">
    				<h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    				<small class="post-info"><strong>Posted: </strong><?php the_time('F jS, Y') ?> in <?php the_category(', ') ?> by <?php the_author() ?></small>
    				<div class="post-desc">
    					<?php the_content('Read more'); ?><span class="post-comments"><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?></span>
    				</div>
    			</div>
    		</div><!-- post ends -->
    	<?php endwhile; ?>
    	</div><!-- content ends -->

    [signature moderated Please read the Forum Rules]

    I resolved the issue by adding
    <?php global $more ?>
    and
    <?php $more = 0 ?>
    in the appropriate places

    Thank you so much for posting your solution! It saved many of my hairs from being pulled out tonight! 🙂

    You proberly do the same using apply_filters() to run the content filter on your post content result (untested but should have the same effect).

    Example use of filter:

    $postcontent = get_the_content();
    echo apply_filters('the_content', $postcontent );

    As an alternative.. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Read more link does not show in posts’ is closed to new replies.