I want to remove the “Continue Reading” link from the teaser excerpt only and not from the automatic excerpt, which filter is easily available.
This is the original code; it’s from the Showcase Template Page Template:
<?php while ( have_posts() ) : the_post(); ?>
<?php
if ( '' != get_the_content() )
get_template_part( 'content', 'intro' );
?>
<?php endwhile; ?>
Here is the Intro:
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'mytheme' ) . '</span>', 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'mytheme' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
–>
Change standard text for all excerpts:
function custom_excerpt_more($more) {
global $post;
$more_text="...";
return '… <a href="'. get_permalink($post->ID) . '">' . $more_text . '</a>';
}
add_filter('excerpt_more', 'custom_excerpt_more');
Create your own excerpt function:
// Rafael Marques Excerpt Function ;)
function rm_excerpt($limit = null, $separator = null) {
// Set standard words limit
if (is_null($limit)){
$excerpt = explode(' ', get_the_excerpt(), '15');
} else {
$excerpt = explode(' ', get_the_excerpt(), $limit);
}
// Set standard separator
if (is_null($separator)){
$separator="...";
}
// Excerpt Generator
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).$separator;
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
echo $excerpt;
}
Use <?php rm_excerpt(); ?>
when you want display custom excerpt. First value set words limit and second value set separator. Example: <?php rm_excerpt(10,' (...)'); ?>
. To create separate link “read more”, insert <a href="https://wordpress.stackexchange.com/questions/83160/<?php the_permalink(); ?>" title="<?php the_title(); ?>">Read More?</a>