Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type called "Blog", in my templates I looping over the blog type and doing the following,

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <section class="news">
                <h2 class="title"><?php echo strtolower(the_title()); ?></h2>
                <h4><?php userphoto_the_author_thumbnail();?> Posted By <?php the_author(); ?> - <?php the_date("l jS M Y"); ?></h4>
                <p class="tags">
                    <?php $tags = wp_get_post_tags($post->ID); ?>
                    <?php foreach ($tags as $tag) : ?>
                        <a href="<?php echo $tag->slug; ?>"> <?php echo $tag->name; ?> </a> |
                    <?php endforeach; ?>
                </p>
                    <?php the_content("Read More"); ?>
            </section>
        <?php endwhile; endif; ?>

My post consists of this content,

Hello World I am teaser  
<!--more-->  
Hello World I am a the content

I am expecting the output to looks like this,

Hello Word I am teaser
<a href="link_url">Read More</a>

However what I am getting is the following,

   Hello World I am teaser  

   Hello World I am a the content
share|improve this question
    
I would look in your theme's function file to see if it is being stripped out for some reason. –  Wyck Aug 12 '11 at 16:42

2 Answers 2

Try adding the global $more variable before you call the_content(). e.g.:

<?php
global $more;
$more = 0;
the_content( 'Read More' );
?>

(This is how you enable the "Read More" tag for Pages.)

share|improve this answer

Try replacing what you have wit this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <section class="news">
        <h2 class="title"><?php echo strtolower(the_title()); ?></h2>
        <h4><?php userphoto_the_author_thumbnail();?> Posted By <?php the_author(); ?> - <?php the_date("l jS M Y"); ?></h4>
        <p class="tags">
            <?php $tags = wp_get_post_tags($post->ID); ?>
            <?php foreach ($tags as $tag) : ?>
                <a href="<?php echo $tag->slug; ?>"> <?php echo $tag->name; ?> </a> |
            <?php endforeach; ?>
        </p>
      <?php the_excerpt(); ?>
    </section>
<?php endwhile; endif; ?>

Then add this to your functions.php in place of what is now there for the more tag (if any exists):

<?php
function all_excerpts_get_more_link($post_excerpt) {
  return '' . $post_excerpt . '' . '<span class="readmore"><a href="'. get_permalink($post->ID) . '">' . 'Read More' . '</span>';
}
add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.